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 | 148 ++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 121 insertions(+), 27 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 df9aac1..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,11 +4,9 @@ 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.IssueStatus; -import kr.wisestone.owl.domain.Project; -import kr.wisestone.owl.domain.ProjectClosure; -import kr.wisestone.owl.domain.UserDepartment; +import kr.wisestone.owl.domain.*; import kr.wisestone.owl.domain.enumType.ProjectType; import kr.wisestone.owl.exception.OwlRuntimeException; import kr.wisestone.owl.mapper.IssueMapper; @@ -56,6 +54,9 @@ private ProjectService projectService; @Autowired + private ProjectRoleDepartmentService projectRoleDepartmentService; + + @Autowired private ProjectClosureService projectClosureService; @Autowired @@ -63,6 +64,9 @@ @Autowired private UserService userService; + + @Autowired + private UserLevelService userLevelService; @Autowired private UserDepartmentService userDepartmentService; @@ -166,9 +170,12 @@ @Override @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()) { + 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()); @@ -210,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){ @@ -245,15 +264,32 @@ Long delayIssue = 0L; // 吏��뿰�맂 �씠�뒋 Long completeIssue = 0L; // �셿猷뚮맂 �씠�뒋 + 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); - - remainIssue = this.widgetMapper.countRemainIssue(widgetCondition); // �옍�뿬 �씠�뒋 - delayIssue = this.widgetMapper.countTodayDelayIssue(widgetCondition); // 吏��뿰�맂 �씠�뒋 - assigneeIssue = this.widgetMapper.countAssigneeIssue(widgetCondition); // �븷�떦�맂 �씠�뒋 - registerIssue = this.widgetMapper.countTodayRegisterIssue(widgetCondition); // �벑濡앺븳 �씠�뒋 - noAssigneeIssue = this.widgetMapper.countNoAssigneeIssue(widgetCondition); // 誘명븷�떦 �씠�뒋 - completeIssue = this.widgetMapper.countCompleteIssue(widgetCondition); // �셿猷뚮맂 �씠�뒋 + 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); // �븷�떦�맂 �씠�뒋 + registerIssue = this.widgetMapper.countTodayRegisterIssue(widgetCondition); // �벑濡앺븳 �씠�뒋 + noAssigneeIssue = this.widgetMapper.countNoAssigneeIssue(widgetCondition); // 誘명븷�떦 �씠�뒋 + completeIssue = this.widgetMapper.countCompleteIssue(widgetCondition); // �셿猷뚮맂 �씠�뒋 + } else { + SetMyDepartmentId(widgetCondition); + remainIssue = this.widgetMapper.countRemainIssueByDepartment(widgetCondition); // �옍�뿬 �씠�뒋 + delayIssue = this.widgetMapper.countTodayDelayIssueByDepartment(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); // �셿猷뚮맂 �씠�뒋 + } } Map<String, Object> results = new HashMap<>(); @@ -277,9 +313,13 @@ public void findProjectProgress(Map<String, Object> resJsonData, WidgetCondition widgetCondition) { 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()) { + 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); @@ -379,11 +419,11 @@ 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); } - // 0.156 - 0.166 int totalPage = (int) Math.ceil((totalCount - 1) / pageable.getPageSize()) + 1; @@ -410,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); } @@ -481,9 +521,20 @@ // �쐞�젽 寃��깋 議곌굔�쓣 留뚮뱾怨� �쟾泥� �봽濡쒖젥�듃 �젙蹂대�� 由ы꽩�븳�떎. Map<String, Object> results = this.makeWidgetConditionAllProject(widgetCondition, getWidgetCondition); + 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 = this.widgetMapper.findProjectMemberIssue(widgetCondition); + List<Map<String, Object>> projectMemberIssues = Lists.newArrayList(); + 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); + } for (Map<String, Object> projectMemberIssue : projectMemberIssues) { //String departmentName = MapUtil.getString(projectMemberIssue, "departmentName"); @@ -761,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) { @@ -788,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 { @@ -804,6 +876,7 @@ // �쐞�젽 寃��깋 議곌굔�쓣 留뚮뱾怨� �쟾泥� �봽濡쒖젥�듃 �젙蹂대�� 由ы꽩�븳�떎. private Map<String, Object> makeWidgetConditionAllProject(WidgetCondition widgetCondition, boolean getWidgetCondition) { Map<String, Object> results = new HashMap<>(); + SetMeAndDownProjectIds(widgetCondition.getProjectIds(), widgetCondition); // �쐞�젽 寃��깋 議곌굔�쓣 �뼸�뼱�빞 �븷 �긽�솴�씪 �븣 - �솕硫댁뿉�꽌 �꺆�쓣 �닃�윭 �뜲�씠�꽣瑜� �옱�슂泥��뻽�쓣 �븣 if (getWidgetCondition) { @@ -864,12 +937,24 @@ List<Map<String, Object>> severityIssues = Lists.newArrayList(); Long totalCount = 0L; + 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); - - severityCounts = this.widgetMapper.countSeverityIssue(widgetCondition); - severityIssues = this.widgetMapper.findSeverityIssues(widgetCondition); - totalCount = this.widgetMapper.countSearchIssue(widgetCondition); + 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); + }else { + SetMyDepartmentId(widgetCondition); + severityCounts = this.widgetMapper.countSeverityIssueByDepartment(widgetCondition); + severityIssues = this.widgetMapper.findSeverityIssuesByDepartment(widgetCondition); + totalCount = this.widgetMapper.countSearchIssueByDepartment(widgetCondition); + } } Long criticalIssueCount = 0L, majorIssueCount = 0L, minorIssueCount = 0L, trivialIssueCount = 0L; @@ -1027,10 +1112,19 @@ // �굹�뿉寃� �븷�떦�맂 �씠�뒋 �젙蹂대�� �뿊��濡� �떎�슫濡쒕뱶 �븳�떎. private ExportExcelVo downloadExcelMyAssigneeIssue() { WidgetCondition widgetCondition = this.makeWidgetCondition(); + + /*widgetCondition.setLoginUserId(this.webAppUtil.getLoginId()); + widgetCondition.setWorkspaceId(this.userService.getUser(this.webAppUtil.getLoginId()).getLastWorkspaceId()); + User user = this.webAppUtil.getLoginUserObject();*/ + // �굹�뿉寃� �븷�떦�맂 �씠�뒋 List<Map<String, Object>> assigneeIssues = Lists.newArrayList(); if (widgetCondition.getProjectIds().size() > 0) { + //if (this.userWorkspaceService.checkWorkspaceManager(user)) { assigneeIssues = this.widgetMapper.findMyAssigneeIssue(this.makeWidgetCondition()); + /*} else { + assigneeIssues = this.widgetMapper.findMyAssigneeIssueByDepartment(this.makeWidgetCondition()); + }*/ } ExportExcelVo excelInfo = new ExportExcelVo(); @@ -1065,7 +1159,7 @@ if (changeAssigneeType != null) { if (changeAssigneeType.equals("1")) { - riskType = this.messageAccessor.message("common.reversalAssigneeUpdate"); // 鍮덈쾲�븳 �떞�떦�옄 蹂�寃� + riskType = this.messageAccessor.message("common.reversalAssigneeTeamUpdate"); // 鍮덈쾲�븳 �떞�떦遺��꽌 蹂�寃� } } @@ -1077,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"); // 鍮덈쾲�븳 �떞�떦遺��꽌 蹂�寃�, 踰덈났�릺�뒗 �긽�깭 蹂�寃� } } @@ -1105,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