From 3bdf2a1f2757de8ab6570508385d89124243943c Mon Sep 17 00:00:00 2001
From: 이민희 <mhlee@maprex.co.kr>
Date: 금, 10 12월 2021 15:34:13 +0900
Subject: [PATCH] 일반회원 대시보드 오류 해결

---
 src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java |   69 +++++++++++++++++++---------------
 1 files changed, 38 insertions(+), 31 deletions(-)

diff --git a/src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java b/src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java
index 2306be7..5f53d71 100644
--- a/src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java
+++ b/src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java
@@ -151,6 +151,9 @@
     private UserWorkspaceService userWorkspaceService;
 
     @Autowired
+    private UserLevelService userLevelService;
+
+    @Autowired
     private WorkflowDepartmentService workflowDepartmentService;
 
     @Autowired
@@ -715,11 +718,11 @@
     public List<IssueVo> findIssue(Map<String, Object> resJsonData, IssueCondition issueCondition, Pageable pageable) {
 
         //  寃��깋 議곌굔�쓣 留뚮뱺�떎
-        if (!this.makeIssueSearchCondition(issueCondition, Lists.newArrayList("01", "02", "03"), pageable)) {
+        /*if (!this.makeIssueSearchCondition(issueCondition, Lists.newArrayList("01", "02", "03"), pageable)) {
             //  �씠�뒋 紐⑸줉�쓣 李얠� 紐삵븷 寃쎌슦 湲곕낯 �젙蹂대줈 由ы꽩�븳�떎.
             this.notFoundIssueList(resJsonData, pageable);
             return Lists.newArrayList();
-        }
+        }*/
 
         Set<String> issueIds = new HashSet<>(); //  �궗�슜�옄 �젙�쓽 �븘�뱶 寃��깋�떆 �굹�삤�뒗 �씠�뒋 �븘�씠�뵒 ���옣 而щ젆�뀡
 
@@ -745,8 +748,10 @@
 
         List<Map<String, Object>> results = Lists.newArrayList();
         Long totalCount = 0L;
+        UserLevel userLevel = this.userLevelService.getUserLevel(user.getUserLevel().getId());
 
-        if (this.userWorkspaceService.checkWorkspaceManager(user) || user.getPermission() >= MngPermission.USER_PERMISSION_MNG_ISSUE_ALL) {
+        if (this.userWorkspaceService.checkWorkspaceManager(user)
+                || MngPermission.checkMngPermission(userLevel.getPermission(), MngPermission.USER_PERMISSION_MNG_ISSUE_PROJECT_ALL)) {
             results = this.issueMapper.find(issueCondition);
             totalCount = this.issueMapper.count(issueCondition);
         } else{
@@ -1033,6 +1038,7 @@
         condition.setWorkspaceId(this.userService.getUser(this.webAppUtil.getLoginId()).getLastWorkspaceId());
         projectCondition.setWorkspaceId(condition.getWorkspaceId());
 
+
         //  �봽濡쒖젥�듃 �궎媛� 議댁옱�븷 寃쎌슦 �봽濡쒖젥�듃 �궎�뿉 �빐�떦�븯�뒗 �봽濡쒖젥�듃瑜� 議고쉶�븯怨� 寃��깋 議곌굔�뿉 �뀑�똿�븳�떎.
         if (!this.getProjectByProjectKey(condition.getProjectKey(), condition)) {
             return false;
@@ -1041,7 +1047,9 @@
         //  �봽濡쒖젥�듃瑜� �꽑�깮�븯吏� �븡�븯�쑝硫� �빐�떦 �뾽臾� 怨듦컙�뿉�꽌 李몄뿬�븯怨� �엳�뒗 �봽濡쒖젥�듃瑜� 李얜뒗�떎.
         if (condition.getProjectIds().size() < 1) {
             List<Map<String, Object>> projects = null;
-            if (this.userWorkspaceService.checkWorkspaceManager(user)) {
+            UserLevel userLevel = this.userLevelService.getUserLevel(user.getUserLevel().getId());
+            if (this.userWorkspaceService.checkWorkspaceManager(user)
+                    || MngPermission.checkMngPermission(userLevel.getPermission(), MngPermission.USER_PERMISSION_MNG_ISSUE_PROJECT_ALL)) {
                 projects = this.projectMapper.findByWorkspaceManagerAll(projectCondition);
             } else  {
                 projects = this.projectService.findByWorkspaceIdAndIncludeProjectAll(projectCondition);
@@ -2155,39 +2163,38 @@
     }
 
     private Issue issueRemoves(Long issueId, User user) {
-        Issue issue = null;
-        if(issueId != null){
-            issue = this.getIssue(issueId);
-        }
-        //  �씠�뒋 �닔�젙 沅뚰븳�쓣 媛뽮퀬 �엳�뒗吏� �솗�씤
-        this.verifyIssueModifyPermission(issue, user);
+        Issue issue = this.findOne(issueId);
+        if(issue != null){
+            //  �씠�뒋 �닔�젙 沅뚰븳�쓣 媛뽮퀬 �엳�뒗吏� �솗�씤
+            this.verifyIssueModifyPermission(issue, user);
 
-        //  �씠�뒋 泥⑤� �뙆�씪�쓣 �궘�젣�븳�떎.
-        if (issue.getAttachedFiles().size() > 0) {
-            List<Long> attachedFileIds = Lists.newArrayList();
+            //  �씠�뒋 泥⑤� �뙆�씪�쓣 �궘�젣�븳�떎.
+            if (issue.getAttachedFiles().size() > 0) {
+                List<Long> attachedFileIds = Lists.newArrayList();
 
-            for (AttachedFile attachedFile : issue.getAttachedFiles()) {
-                attachedFileIds.add(attachedFile.getId());
+                for (AttachedFile attachedFile : issue.getAttachedFiles()) {
+                    attachedFileIds.add(attachedFile.getId());
+                }
+                //  泥⑤��뙆�씪 �궘�젣
+                this.attachedFileService.removeAttachedFiles(attachedFileIds);
             }
-            //  泥⑤��뙆�씪 �궘�젣
-            this.attachedFileService.removeAttachedFiles(attachedFileIds);
-        }
 
-        // 吏��슱 �씠�뒋媛� �뿰愿��씠�뒋�씤吏� 泥댄겕 �썑 �뿰愿��씠�뒋 �뀒�씠釉붿뿉�꽌�룄 �궘�젣�븳�떎.
-        List<IssueRelation> issueRelationList = this.issueRelationRepository.findByRelationIssueId(issueId);
-        if (issueRelationList != null && issueRelationList.size() > 0) {
-            for(IssueRelation issueRelation : issueRelationList){
-                StringBuilder sb = new StringBuilder();
-                issueHistoryService.detectRelationIssue(IssueHistoryType.DELETE, issueRelation, sb);
-                issueHistoryService.addIssueHistory(issueRelation.getIssue(), IssueHistoryType.MODIFY, sb.toString());
-                this.issueRelationRepository.delete(issueRelation);
+            // 吏��슱 �씠�뒋媛� �뿰愿��씠�뒋�씤吏� 泥댄겕 �썑 �뿰愿��씠�뒋 �뀒�씠釉붿뿉�꽌�룄 �궘�젣�븳�떎.
+            List<IssueRelation> issueRelationList = this.issueRelationRepository.findByRelationIssueId(issueId);
+            if (issueRelationList != null && issueRelationList.size() > 0) {
+                for(IssueRelation issueRelation : issueRelationList){
+                    StringBuilder sb = new StringBuilder();
+                    issueHistoryService.detectRelationIssue(IssueHistoryType.DELETE, issueRelation, sb);
+                    issueHistoryService.addIssueHistory(issueRelation.getIssue(), IssueHistoryType.MODIFY, sb.toString());
+                    this.issueRelationRepository.delete(issueRelation);
+                }
             }
-        }
 
-        //  �씠�뒋 �깮�꽦, �궘�젣�떆 �삁�빟 �씠硫붿씪�뿉 �벑濡앺빐�넃�뒗�떎.
-        this.reservationIssueEmail(issue, EmailType.ISSUE_REMOVE);
-        //  �씠�뒋 �궘�젣
-        this.issueRepository.delete(issue);
+            //  �씠�뒋 �깮�꽦, �궘�젣�떆 �삁�빟 �씠硫붿씪�뿉 �벑濡앺빐�넃�뒗�떎.
+            this.reservationIssueEmail(issue, EmailType.ISSUE_REMOVE);
+            //  �씠�뒋 �궘�젣
+            this.issueRepository.delete(issue);
+        }
 
         return issue;
     }

--
Gitblit v1.8.0