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  |    8 ++-
 src/main/webapp/scripts/app/project/projectModify.controller.js     |    2 
 src/main/java/kr/wisestone/owl/service/impl/ProjectServiceImpl.java |    4 +-
 src/main/webapp/views/project/projectAdd.html                       |    8 ++--
 src/main/webapp/views/project/projectModify.html                    |    7 ++-
 src/main/resources/mybatis/query-template/widget-template.xml       |   18 +++++++++
 src/main/webapp/views/issue/issueDetail.html                        |   11 +----
 src/main/webapp/scripts/app/issue/issueDetail.controller.js         |   53 ++++++++++++++------------
 src/main/webapp/scripts/app/project/projectAdd.controller.js        |    2 
 9 files changed, 65 insertions(+), 48 deletions(-)

diff --git a/src/main/java/kr/wisestone/owl/service/impl/ProjectServiceImpl.java b/src/main/java/kr/wisestone/owl/service/impl/ProjectServiceImpl.java
index 27fb86f..35baccf 100644
--- a/src/main/java/kr/wisestone/owl/service/impl/ProjectServiceImpl.java
+++ b/src/main/java/kr/wisestone/owl/service/impl/ProjectServiceImpl.java
@@ -121,8 +121,8 @@
         project.setProjectKey("BTS");
         project.setStatus(Project.PROJECT_OPEN);
         project.setDescription(this.messageAccessor.message("common.intoTheSystemIssueManagementProject")); // �떆�뒪�뀥�뿉�꽌 湲곕낯�쑝濡� �젣怨듬릺�뒗 �씠�뒋 愿�由� �봽濡쒖젥�듃�엯�땲�떎.
-        project.setStartDate(DateUtil.convertDateToYYYYMMDD(new Date()));
-        project.setEndDate(DateUtil.convertDateToYYYYMMDD(DateUtil.addDays(new Date(), 3650)));
+        //project.setStartDate(DateUtil.convertDateToYYYYMMDD(new Date()));
+        //project.setEndDate(DateUtil.convertDateToYYYYMMDD(DateUtil.addDays(new Date(), 3650)));
         //  湲곕낯�쑝濡� �깮�꽦�릺�뒗 �봽濡쒖젥�듃�쓽 �쑀�삎�� BTS
         project.setProjectType(ProjectType.BTS_PROJECT);
         project.setWorkspace(workspace);
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 970ef1f..b2b71cc 100644
--- a/src/main/java/kr/wisestone/owl/service/impl/WidgetServiceImpl.java
+++ b/src/main/java/kr/wisestone/owl/service/impl/WidgetServiceImpl.java
@@ -283,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); // �셿猷뚮맂 �씠�뒋
             }
@@ -448,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);
         }
diff --git a/src/main/resources/mybatis/query-template/widget-template.xml b/src/main/resources/mybatis/query-template/widget-template.xml
index 26e1ace..1f57277 100644
--- a/src/main/resources/mybatis/query-template/widget-template.xml
+++ b/src/main/resources/mybatis/query-template/widget-template.xml
@@ -953,12 +953,21 @@
         <if test="page != null and !page.equals('')">
             INNER JOIN issue_status iss ON iss.id = i.issue_status_id
             INNER JOIN project p ON p.id = i.project_id
+            LEFT OUTER join issue_department isd on isd.issue_id = i.id
         </if>
         WHERE 1=1
         <choose>
             <when test="projectIds != null and projectIds.size != 0">
                 AND i.project_id IN
                 <foreach collection="projectIds" item="item" index="index" separator="," open="(" close=")">
+                    #{item}
+                </foreach>
+            </when>
+        </choose>
+        <choose>
+            <when test="myDepartmentIds != null and myDepartmentIds.size != 0">
+                AND isd.department_id IN
+                <foreach collection="myDepartmentIds" item="item" index="index" separator="," open="(" close=")">
                     #{item}
                 </foreach>
             </when>
@@ -977,6 +986,7 @@
         SELECT
         COUNT(DISTINCT i.id) FROM issue i
         INNER JOIN project p ON p.id = i.project_id
+        LEFT OUTER join issue_department isd on isd.issue_id = i.id
         <if test="page != null and !page.equals('')">
             INNER JOIN issue_status iss ON iss.id = i.issue_status_id
         </if>
@@ -989,6 +999,14 @@
                 </foreach>
             </when>
         </choose>
+        <choose>
+            <when test="myDepartmentIds != null and myDepartmentIds.size != 0">
+                AND isd.department_id IN
+                <foreach collection="myDepartmentIds" item="item" index="index" separator="," open="(" close=")">
+                    #{item}
+                </foreach>
+            </when>
+        </choose>
         AND i.complete_date IS NOT NULL
         AND i.complete_date <![CDATA[ < ]]> #{completeDate}
         <if test="page != null and !page.equals('')">
diff --git a/src/main/webapp/scripts/app/issue/issueDetail.controller.js b/src/main/webapp/scripts/app/issue/issueDetail.controller.js
index 800f3a7..5ea1f0a 100644
--- a/src/main/webapp/scripts/app/issue/issueDetail.controller.js
+++ b/src/main/webapp/scripts/app/issue/issueDetail.controller.js
@@ -444,15 +444,16 @@
                         .setHWidth("width-60-p bold")
                         .setHSort(false)
                         .setDRenderer("ISSUE_RELATION_MOVE"))
-                    $scope.vm.relTableConfigs.push($tableProvider.config()
-                        .setHName("issue.relationIssueDelete")
-                        .setDType("renderer")
-                        .setDAlign("text-center")
-                        .setHWidth("width-40-p bold")
-                        .setDRenderer("ISSUE_RELATION_DELETE")
-                        .setHSort(false)
-                        .setDAlign("text-center"))
-
+                    if($scope.vm.viewer.modifyPermissionCheck) {
+                        $scope.vm.relTableConfigs.push($tableProvider.config()
+                            .setHName("issue.relationIssueDelete")
+                            .setDType("renderer")
+                            .setDAlign("text-center")
+                            .setHWidth("width-40-p bold")
+                            .setDRenderer("ISSUE_RELATION_DELETE")
+                            .setHSort(false)
+                            .setDAlign("text-center"))
+                    }
                     angular.forEach($scope.vm.relTableConfigs, function (Rel_issueTableConfig) {
                         //  �몴�떆 ���긽�씤 而щ읆留� �솕硫댁뿉 洹몃젮以��떎.
                         if (Rel_issueTableConfig.display) {
@@ -533,14 +534,15 @@
 
                             }
                         });
-                        $scope.vm.relTableConfigs.push($tableProvider.config()
-                            .setHName("issue.relationIssueDelete")
-                            .setDType("renderer")
-                            .setHWidth("width-40-p bold")
-                            .setDRenderer("ISSUE_RELATION_DELETE")
-                            .setHSort(false)
-                            .setDAlign("text-center"))
-
+                        if($scope.vm.viewer.modifyPermissionCheck) {
+                            $scope.vm.relTableConfigs.push($tableProvider.config()
+                                .setHName("issue.relationIssueDelete")
+                                .setDType("renderer")
+                                .setHWidth("width-40-p bold")
+                                .setDRenderer("ISSUE_RELATION_DELETE")
+                                .setHSort(false)
+                                .setDAlign("text-center"))
+                        }
                     } else {
                         makeRelTableConfigs();
                     }
@@ -575,14 +577,15 @@
                                 $scope.fn.setDownTableColumn(Down_issueTableConfig);
                             }
                         });
-                        $scope.vm.downTableConfigs.push($tableProvider.config()
-                            .setHName("issue.relationIssueDelete")
-                            .setDType("renderer")
-                            .setHWidth("width-40-p bold")
-                            .setDRenderer("ISSUE_DOWN_DELETE")
-                            .setHSort(false)
-                            .setDAlign("text-center"))
-
+                        if($scope.vm.viewer.modifyPermissionCheck) {
+                            $scope.vm.downTableConfigs.push($tableProvider.config()
+                                .setHName("issue.relationIssueDelete")
+                                .setDType("renderer")
+                                .setHWidth("width-40-p bold")
+                                .setDRenderer("ISSUE_DOWN_DELETE")
+                                .setHSort(false)
+                                .setDAlign("text-center"))
+                        }
                     } else {
                         makeDownTableConfigs();
                     }
diff --git a/src/main/webapp/scripts/app/project/projectAdd.controller.js b/src/main/webapp/scripts/app/project/projectAdd.controller.js
index ab7ba34..664405c 100644
--- a/src/main/webapp/scripts/app/project/projectAdd.controller.js
+++ b/src/main/webapp/scripts/app/project/projectAdd.controller.js
@@ -84,7 +84,7 @@
                         name : $rootScope.preventXss($scope.vm.form.name),
                         projectKey : $scope.vm.form.projectKey,
                         projectType : $scope.vm.form.projectType,
-                        parentProjectId : $scope.vm.projectName != null && $scope.vm.projectName.length > 0 ? $scope.vm.form.projects[0].id : null,
+                        //parentProjectId : $scope.vm.projectName != null && $scope.vm.projectName.length > 0 ? $scope.vm.form.projects[0].id : null,
                         status : $scope.vm.form.status,
                         startDate : "",
                         endDate : "",
diff --git a/src/main/webapp/scripts/app/project/projectModify.controller.js b/src/main/webapp/scripts/app/project/projectModify.controller.js
index 86a5907..722b8ba 100644
--- a/src/main/webapp/scripts/app/project/projectModify.controller.js
+++ b/src/main/webapp/scripts/app/project/projectModify.controller.js
@@ -112,7 +112,7 @@
 
                     var content = {
                         id : $scope.vm.form.id,
-                        parentProjectId : $scope.vm.projectName.length > 0 && $scope.vm.projectName == $scope.vm.form.parentProjects[0].name ? $scope.vm.form.parentProjects[0].id : null,
+                        //parentProjectId : $scope.vm.projectName.length > 0 && $scope.vm.projectName == $scope.vm.form.parentProjects[0].name ? $scope.vm.form.parentProjects[0].id : null,
                         name : $rootScope.preventXss($scope.vm.form.name),
                         status : $scope.vm.form.status,
                         startDate : "",
diff --git a/src/main/webapp/views/issue/issueDetail.html b/src/main/webapp/views/issue/issueDetail.html
index d7c46b0..71aff7d 100644
--- a/src/main/webapp/views/issue/issueDetail.html
+++ b/src/main/webapp/views/issue/issueDetail.html
@@ -498,7 +498,7 @@
                     <js-table data="vm.viewer.issueRelationVos" table-configs="vm.relTableConfigs"
                               event="relTableEvent" detail-view="true" hide-header="false" use-sort="true"></js-table>
 
-                    <div class="row">
+                    <div class="row" ng-if="vm.viewer.modifyPermissionCheck">
                         <div class="col-sm-4">
                             <select id="relationIssueType"
                                     name="relationIssueType"
@@ -524,16 +524,13 @@
                         </div>
                         <div class="col-auto vertical-middle" style="display: flex">
                             <button type="button" class="btn btn-primary"
-                                    ng-if="vm.viewer.modifyPermissionCheck"
                                     ng-click="fn.addRelationIssue()"
                                     translate="issue.addRelationIssue">�뿰愿� �씠�뒋 異붽�</button>
                             <button type="button" class="btn btn-sm btn-primary btn-roundRel  offset-1"
-                                    ng-if="vm.viewer.modifyPermissionCheck"
                                     ng-click="fn.addRelationIssueForm(vm.viewer.id)">
                                 <i class="os-icon os-icon-plus"><span></span></i>
                             </button>
                         </div>
-
                     </div>
                 </div>
 
@@ -557,8 +554,7 @@
                     <js-table data="vm.viewer.issueDownVos" table-configs="vm.downTableConfigs"
                               event="downTableEvent" detail-view="true" hide-header="false" use-sort="true"></js-table>
 
-                    <div class="row">
-
+                    <div class="row" ng-if="vm.viewer.modifyPermissionCheck">
                         <div class="col-sm-6">
                             <js-autocomplete-single data-input-name="issue"
                                                     selected-model="vm.form.issuesDown"
@@ -573,16 +569,13 @@
                         </div>
                         <div class="col-auto vertical-middle" style="display: flex">
                             <button type="button" class="btn btn-primary"
-                                    ng-if="vm.viewer.modifyPermissionCheck"
                                     ng-click="fn.addDownIssue()"
                                     translate="issue.addDownIssue">異붽�</button>
                             <button type="button" class="btn btn-sm btn-primary btn-roundRel  offset-1"
-                                    ng-if="vm.viewer.modifyPermissionCheck"
                                     ng-click="fn.addDownIssueForm(vm.viewer.id)">
                                 <i class="os-icon os-icon-plus"><span></span></i>
                             </button>
                         </div>
-
                     </div>
                 </div>
 
diff --git a/src/main/webapp/views/project/projectAdd.html b/src/main/webapp/views/project/projectAdd.html
index d2315af..4b11f4c 100644
--- a/src/main/webapp/views/project/projectAdd.html
+++ b/src/main/webapp/views/project/projectAdd.html
@@ -64,8 +64,9 @@
                 </small>
             </div>
 
-            <div class="row">
-                <div class="col-lg-6">
+            <!--<div class="row">-->
+            <div>
+                <div class="form-group">
                     <div class="form-group">
                         <label><span translate="common.period">湲곌컙</span></label>
                         <input tabindex="-1"
@@ -142,9 +143,8 @@
                                        translation-texts="{ count : 'common.userNum', empty : 'common.emptyProjectDepartment' }"
                                        extra-settings="{ displayProp : 'byName' , idProp : 'id', imageable : false, maxlength : 100, autoResize : true }"></js-autocomplete-multi>
 
-
                 <div class="select3-selection__choicediv mt-10">
-                    <span class="select3-selection__choice" ng-repeat="user in vm.form.users">
+                    <span class="select3-selection__choice" ng-repeat="department in vm.form.departments">
                        <span>{{department.byName}}</span> <!--�궗�슜�옄媛� �냽�빐 �엳�뒗 遺��꽌 �씠由� 異쒕젰-->
                         <span class="select3-selection__choice__remove" ng-click="fn.removeDepartment($index)">횞</span>
                     </span>
diff --git a/src/main/webapp/views/project/projectModify.html b/src/main/webapp/views/project/projectModify.html
index 4a10814..24613ea 100644
--- a/src/main/webapp/views/project/projectModify.html
+++ b/src/main/webapp/views/project/projectModify.html
@@ -30,10 +30,11 @@
                 <small translate="project.limitNameToSpecialCharacters">�봽濡쒖젥�듃 紐낆� �듅�닔 臾몄옄瑜� �엯�젰�븷 �닔 �뾾�뒿�땲�떎.</small>
             </div>
 
-            <div class="row">
-                <div class="col-lg-6">
+            <!--<div class="row">-->
+            <div>
+                <div class="form-group">
                     <div class="form-group">
-                        <label for="projectModifyForm2"><span translate="common.period">湲곌컙</span></label>
+                        <label><span translate="common.period">湲곌컙</span></label>
                         <input tabindex="-1"
                                type="text"
                                class="form-control input-readonly"

--
Gitblit v1.8.0