OWL ITS + 탐지시스템(인터넷 진흥원)
박지현
2022-02-22 302112b8c095984fe054bb357cbbd2ef3d88e844
src/main/webapp/scripts/app/issue/issueDetail.controller.js
@@ -50,6 +50,7 @@
                $scope.fn.setDownTableConfigs = setDownTableConfigs;
                $scope.fn.containsPartner = containsPartner;
                $scope.fn.onActivate = onActivate;
                $scope.fn.issueBack = issueBack;
                $scope.fn.goParentIssue = goParentIssue;
                $scope.fn.removeRelationIssue = removeRelationIssue;
                $scope.fn.removeDownIssue = removeDownIssue;
@@ -113,6 +114,7 @@
                $scope.vm.issueName = "";       // 선택된 연관 일감 이름
                $scope.vm.issueId = "";       //
                $scope.vm.parentIssueId = "";
                $scope.vm.issueTypeId = "";
                $scope.vm.autoCompletePage = {
                    issue : {
@@ -120,6 +122,9 @@
                        totalPage : 0
                    },
                };
                $scope.vm.inheritPartners = "";
                $scope.vm.downTotalCount = "";
                $scope.vm.relResponseData = [];
                $scope.vm.relTableConfigs = [];
@@ -145,14 +150,22 @@
                    $scope.fn.onActivate();
                }
                // 상위 이슈 클릭시 상위 이슈로 이동
                function goParentIssue() {
                // 뒤로가기 버튼
                function issueBack() {
                    var index = $scope.$parent.vm.issueIds.length -2;
                    if (index > -1) {
                        var preIssueId = $scope.$parent.vm.issueIds[index];
                        $scope.$parent.vm.issueIds.splice(index + 1, 1);
                        $scope.$parent.tableEvent.changeDetailView(preIssueId, true);
                    }
                }
                // 상위 이슈 클릭시 상위 이슈로 이동
                function goParentIssue() {
                    var parentIssueId = $scope.vm.parentIssueId;
                    $scope.$parent.tableEvent.changeDetailView(parentIssueId, true);
                    //하위이슈-> 상위이슈 -> 연관이슈에서 뒤로가기 버튼 클릭 시 하위이슈로 이동되는 문제로 마지막 배열값 제거
                    $scope.$parent.vm.issueIds.pop();
                }
                //  페이지 변경
@@ -673,7 +686,7 @@
                        $scope.vm.issueRelTableConfigs = [];
                        $scope.vm.issueRelTableConfigs = JSON.parse(issueTableConfigs);
                        $scope.vm.issueRelTableConfigs.sort(function (a, b) {
                            return a.position < b.position ? -1 : a.position > b.position ? 1 : 0;
                            return parseInt(a.position) < parseInt(b.position) ? -1 : parseInt(a.position) > parseInt(b.position) ? 1 : 0;
                        });
                        $scope.vm.relTableConfigs = [];
@@ -729,7 +742,7 @@
                        $scope.vm.issueDownTableConfigs = [];
                        $scope.vm.issueDownTableConfigs = JSON.parse(issueTableConfigs);
                        $scope.vm.issueDownTableConfigs.sort(function (a, b) {
                            return a.position < b.position ? -1 : a.position > b.position ? 1 : 0;
                            return parseInt(a.position) < parseInt(b.position) ? -1 : parseInt(a.position) > parseInt(b.position) ? 1 : 0;
                        });
                        $scope.vm.downTableConfigs = [];
/*                      $scope.vm.downTableConfigs.push($downProvider.config()
@@ -800,28 +813,50 @@
                        return;
                    }
                    var ids = [];
                    if ($scope.vm.form.issuesDown[0].id != null) {
                        ids.push($scope.vm.form.issuesDown[0].id);
                    let inheritYn = false;
                    if ($scope.vm.inheritPartners) {
                        SweetAlert.swal({
                                title : $filter("translate")("issue.addDownIssue"), // 하위 이슈 추가
                                text : $filter("translate")("issue.wantToInheritPartnersOfParentIssue"), // 상위이슈의 파트너 정보(업체/ISP/호스팅)를 적용시키겠습니까?
                                type : "warning",
                                showCancelButton : true,
                                confirmButtonColor : "#DD6B55",
                                confirmButtonText : $filter("translate")("common.ok"), // 네
                                cancelButtonText : $filter("translate")("common.no"), // 아니오
                                closeOnConfirm : false,
                                closeOnCancel : false
                            },
                            function (isConfirm) {
                                if (isConfirm) {
                                    inheritYn = true;
                                }
                                var ids = [];
                                if ($scope.vm.form.issuesDown[0].id != null) {
                                    ids.push($scope.vm.form.issuesDown[0].id);
                                }
                                var contents = {
                                    issueId : $rootScope.currentDetailIssueId,
                                    ids : ids,
                                    parentIssueId : $rootScope.currentDetailIssueId,
                                    inheritYn : inheritYn
                                };
                                Issue.modifyParentIssue($resourceProvider.getContent(
                                    contents,
                                    $resourceProvider.getPageContent(0, 10))).then(function (result) {
                                    if (result.data.message.status === "success") {
                                        SweetAlert.close();
                                        $scope.fn.getIssueDetail(0,0);
                                    }
                                    else {
                                        SweetAlert.error($filter("translate")("issue.failedToIssueAddIssueDown"), result.data.message.message); // "하위이슈 생성 실패"
                                    }
                                });
                            });
                    }
                    var contents = {
                        issueId : $rootScope.currentDetailIssueId,
                        ids : ids,
                        parentIssueId : $rootScope.currentDetailIssueId
                    };
                    Issue.modifyParentIssue($resourceProvider.getContent(
                        contents,
                        $resourceProvider.getPageContent(0, 10))).then(function (result) {
                        if (result.data.message.status === "success") {
                            $scope.fn.getIssueDetail(0,0);
                        }
                        else {
                            SweetAlert.error($filter("translate")("issue.failedToIssueAddIssueDown"), result.data.message.message); // "연관일감 생성 실패"
                        }
                    });
                }
                 // 이슈명을 클릭하면 이슈 상세 정보를 조회한다.
@@ -1112,6 +1147,10 @@
                                //  활동 이력 만들기
                                $scope.fn.makeActiveHistory();
                                if ($rootScope.isDefined($scope.vm.viewer.parentIssueVo)) {
                                    $scope.vm.parentIssueId = $scope.vm.viewer.parentIssueVo.id;
                                }
                                $scope.vm.viewer.startDate = result.data.data.startDate == null ? "common.unspecified" : result.data.data.startDate; // 미지정
                                $scope.vm.viewer.completeDate = result.data.data.completeDate == null ? "common.unspecified" : result.data.data.completeDate; // 미지정
@@ -1160,8 +1199,11 @@
                                $scope.vm.viewer.issueDownVos = result.data.data.issueDownVos;
                                if ($rootScope.workProject.id > -1 && result.data.data.projectVo !== null) {
                                    $rootScope.changeLastProject(result.data.data.projectVo.id);
                                    $rootScope.changeLastProject(result.data.data.projectVo.id, false, false);
                                }
                                $scope.vm.inheritPartners = result.data.data.issueTypeVo.inheritPartners;
                                $scope.vm.downTotalCount = result.data.data.downTotalCount;
                            }
                        }
                        else {
@@ -1245,21 +1287,69 @@
                //  활동 이력 만들기
                function makeActiveHistory() {
                    $scope.vm.viewer.activeParentHistory = "";
                    $scope.vm.viewer.activeHistory = "";
                    $scope.vm.viewer.activeParentHistory = [];
                    $scope.vm.viewer.activeHistory = [];
                    $scope.vm.viewer.activeParentMailHistory = [];
                    $scope.vm.viewer.activeAllMailAndReplyHistory = []; //상위+하위 메일,댓글 히스토리
                    var oriMailHistory = [];
                    var oriCommentHistory = [];
                    if ($scope.vm.viewer.issueHistoryVos != null && $scope.vm.viewer.issueHistoryVos.length > 0) {
                        //  상위이슈 메일 히스토리
                        for (var i=0; i<$scope.vm.viewer.issueHistoryVos.length; i++) {
                            if ($scope.vm.viewer.issueHistoryVos[i].issueHistoryType === "SEND") {
                                oriMailHistory.push($scope.vm.viewer.issueHistoryVos[i]);
                            }
                        }
                        //$scope.vm.viewer.activeParentMailHistory = angular.copy(oriMailHistory);
                    }
                    //  상위이슈 댓글 히스토리
                    if ($scope.vm.viewer.issueCommentVos != null && $scope.vm.viewer.issueCommentVos.length > 0) {
                        for (var i=0; i<$scope.vm.viewer.issueCommentVos.length; i++) {
                            oriCommentHistory.push($scope.vm.viewer.issueCommentVos[i]);
                        }
                    }
                    $scope.vm.viewer.activeAllMailAndReplyHistory = oriMailHistory.concat(oriCommentHistory);
                    //  하위이슈 히스토리
                    if ($scope.vm.viewer.issueDownVos != null && $scope.vm.viewer.issueDownVos.length > 0) {
                        $scope.vm.viewer.activeDownHistory = ""; //하위이슈 히스토리만
                        $scope.vm.viewer.downComment = ""; //하위이슈 댓글만
                        $scope.vm.viewer.activeDownAllHistory = ""; //하위이슈 히스토리+댓글
                        $scope.vm.viewer.activeDownHistory = []; //하위이슈 히스토리만
                        $scope.vm.viewer.downComment = []; //하위이슈 댓글만
                        $scope.vm.viewer.activeDownAllHistory = []; //하위이슈 히스토리+댓글
                        $scope.vm.viewer.activeDownMailAndReplyHistory = []; //하위 메일+댓글 히스토리
                        var downTitle = "";
                        var oriDownHistory = [];
                        var oriDownCommentHistory = [];
                        var oriDownMailHistory = [];
                        // 하위이슈 히스토리
                        for (var i=0; i<$scope.vm.viewer.issueDownVos.length; i++){
                            oriDownHistory.push($scope.vm.viewer.issueDownVos[i].issueHistoryVos);
                            oriDownCommentHistory.push($scope.vm.viewer.issueDownVos[i].issueCommentVos);
                            //  하위이슈 메일 기록
                            for (var j=0; j<$scope.vm.viewer.issueDownVos[i].issueHistoryVos.length; j++) {
                                if($scope.vm.viewer.issueDownVos[i].issueHistoryVos[j].issueHistoryType === "SEND") {
                                    oriDownMailHistory.push($scope.vm.viewer.issueDownVos[i].issueHistoryVos[j]);
                                }
                            }
                            //  하위이슈 댓글 기록
                            for (var k=0; k<$scope.vm.viewer.issueDownVos[i].issueCommentVos.length; k++) {
                                oriDownCommentHistory.push($scope.vm.viewer.issueDownVos[i].issueCommentVos[k]);
                            }
                        }
                        //  하위이슈 메일+댓글 저장
                        $scope.vm.viewer.activeDownMailAndReplyHistory = oriDownCommentHistory.concat(oriDownMailHistory);
                        for (var i=0; i<$scope.vm.viewer.activeDownMailAndReplyHistory.length; i++){
                            downTitle = "<div class='dot' style='margin-bottom: -8px'>*하위이슈 : "+$scope.vm.viewer.activeDownMailAndReplyHistory[i].title+"</div>";
                            $scope.vm.viewer.activeDownMailAndReplyHistory[i].desc = downTitle + $scope.vm.viewer.activeDownMailAndReplyHistory[i].description;
                        }
                        $scope.vm.viewer.activeDownMailAndReplyHistory.sort(function (a, b) {   //"MAIL_AND_REPLY_DOWN" 내림차순
                            return a.registerDate > b.registerDate ? -1 : a.registerDate < b.registerDate ? 1 : 0;
                        });
                        for (var i=0; i<oriDownHistory.length; i++){
                            if ($scope.vm.viewer.activeDownHistory === "") {
                                $scope.vm.viewer.activeDownHistory = oriDownHistory[i];
@@ -1277,29 +1367,41 @@
                        });
                        // 하위이슈 댓글 히스토리
                       for (var i=0; i<oriDownCommentHistory.length; i++) {
                        for (var i=0; i<oriDownCommentHistory.length; i++) {
                           if ($scope.vm.viewer.downComment === "") {
                               $scope.vm.viewer.downComment = oriDownCommentHistory[i];
                           } else {
                               $scope.vm.viewer.downComment = $scope.vm.viewer.downComment.concat(oriDownCommentHistory[i]);
                           }
                       }
                       $scope.vm.viewer.issueDownVos.sort(function (a, b) {   //내림차순
                           return a.registerDate > b.registerDate ? -1 : a.registerDate < b.registerDate ? 1 : 0;
                       });
                        }
                        $scope.vm.viewer.issueDownVos.sort(function (a, b) {   //내림차순
                            return a.registerDate > b.registerDate ? -1 : a.registerDate < b.registerDate ? 1 : 0;
                        });
                       $scope.vm.viewer.activeDownAllHistory = $scope.vm.viewer.downComment.concat($scope.vm.viewer.activeDownHistory);
                       $scope.vm.viewer.activeParentHistory = $scope.vm.viewer.issueCommentVos.concat($scope.vm.viewer.issueHistoryVos);
                       $scope.vm.viewer.activeHistory = $scope.vm.viewer.activeParentHistory.concat($scope.vm.viewer.activeDownAllHistory);
                        $scope.vm.viewer.activeDownAllHistory = $scope.vm.viewer.downComment.concat($scope.vm.viewer.activeDownHistory);
                        $scope.vm.viewer.activeDownAllHistory.sort(function (a, b) {   //"RECODE_DOWN" 내림차순
                            return a.registerDate > b.registerDate ? -1 : a.registerDate < b.registerDate ? 1 : 0;
                        });
                        $scope.vm.viewer.activeParentHistory = $scope.vm.viewer.issueCommentVos.concat($scope.vm.viewer.issueHistoryVos);
                        $scope.vm.viewer.activeHistory = $scope.vm.viewer.activeParentHistory.concat($scope.vm.viewer.activeDownAllHistory);
                        $scope.vm.viewer.activeAllMailAndReplyHistory = $scope.vm.viewer.activeAllMailAndReplyHistory.concat($scope.vm.viewer.activeDownMailAndReplyHistory);
                    }else {
                        $scope.vm.viewer.activeParentHistory = $scope.vm.viewer.issueCommentVos.concat($scope.vm.viewer.issueHistoryVos);
                        $scope.vm.viewer.activeHistory = $scope.vm.viewer.issueCommentVos.concat($scope.vm.viewer.issueHistoryVos);
                    }
                    $scope.vm.viewer.activeParentHistory.sort(function (a, b) {   //내림차순
                    $scope.vm.viewer.activeHistory.sort(function (a, b) {   //"ALL" 내림차순
                        return a.registerDate > b.registerDate ? -1 : a.registerDate < b.registerDate ? 1 : 0;
                    });
                    $scope.vm.viewer.activeHistory.sort(function (a, b) {   //내림차순
                    $scope.vm.viewer.activeParentHistory.sort(function (a, b) {   //"RECODE" 내림차순
                        return a.registerDate > b.registerDate ? -1 : a.registerDate < b.registerDate ? 1 : 0;
                    });
                    $scope.vm.viewer.activeAllMailAndReplyHistory.sort(function (a, b) {   //"MAIL_AND_REPLY" 내림차순
                        return a.registerDate > b.registerDate ? -1 : a.registerDate < b.registerDate ? 1 : 0;
                    });
                }