Index: arms/js/analysis/topmenu/topMenuApi.js =================================================================== diff -u -ra262c087df00f5d5cc3b9424f170cc9d394fd731 -r2248a8a1c98baa197f6d43d9640c0a8f6d98a96c --- arms/js/analysis/topmenu/topMenuApi.js (.../topMenuApi.js) (revision a262c087df00f5d5cc3b9424f170cc9d394fd731) +++ arms/js/analysis/topmenu/topMenuApi.js (.../topMenuApi.js) (revision 2248a8a1c98baa197f6d43d9640c0a8f6d98a96c) @@ -24,11 +24,23 @@ "subtask" : null }; + // 작업자수 - 필요할까? var resource = { - + "total" : null, + "resourceInfo" : null }; + var pullTotalApi = function(pdService_id, pdServiceVersionLinks) { + return Promise.all([ + reqStateData(pdService_id, pdServiceVersionLinks), + versionPeriod(pdServiceVersionLinks), + reqAndSubtaskIssue(pdService_id, pdServiceVersionLinks), + resourceInfo(pdService_id, pdServiceVersionLinks) + ]); + }; + + ////////////////////////////////// // 요구사항(DB)의 상태 - Application ////////////////////////////////// @@ -42,54 +54,84 @@ return req_state_data; }; + //완료 var reqStateData = function (pdService_id, pdServiceVersionLinks) { - let reqAddUrl = "/T_ARMS_REQADD_"+ pdService_id +"/getReqAddListByFilter.do?"; + return new Promise((resolve, reject) => { + let reqAddUrl = "/T_ARMS_REQADD_"+ pdService_id +"/getReqAddListByFilter.do?"; - $.ajax({ - url: "/auth-user/api/arms/analysis/scope/top-menu" +reqAddUrl, - type: "GET", - data: { pdServiceId: pdService_id, pdServiceVersionLinks: pdServiceVersionLinks }, - contentType: "application/json;charset=UTF-8", - dataType: "json", - progress: true, - statusCode: { - 200: function (result) { - console.log("[ topMenuApi :: reqStateData ] :: result"); - console.log(result); - setReqStateData(result); - } - } - }); - }; - - ////////////////////////////////// - // 버전 기간 - Application - ////////////////////////////////// - var versionPeriod = function (pdServiceVersionLinks) { - if(pdServiceVersionLinks && pdServiceVersionLinks.length > 0) { $.ajax({ - url: "/auth-user/api/arms/pdServiceVersion/getVersionListBy.do", - data: {c_ids: pdServiceVersionLinks}, + url: "/auth-user/api/arms/analysis/top-menu" +reqAddUrl, type: "GET", + data: { pdServiceId: pdService_id, pdServiceVersionLinks: pdServiceVersionLinks }, contentType: "application/json;charset=UTF-8", dataType: "json", progress: true, statusCode: { 200: function (result) { - console.log("[ topMenuApi :: versionPeriod ] :: result"); + console.log("[ topMenuApi :: reqStateData ] :: result"); console.log(result); - setVersionPeriod(result); + setReqStateData(result); + resolve(); } } }); - } + }); }; - var setVersionPeriod = function (param) { - period_date["start_date"] = param["earliestDate"]; - period_date["end_date"] = param["latestDate"]; + ////////////////////////////////// + // 버전 기간 - Application + ////////////////////////////////// + var versionPeriod = function (pdServiceVersionLinks) { + return new Promise((resolve, reject) => { + if(pdServiceVersionLinks && pdServiceVersionLinks.length > 0) { + $.ajax({ + url: "/auth-user/api/arms/pdServiceVersion/getVersionListBy.do", + data: {c_ids: pdServiceVersionLinks}, + type: "GET", + contentType: "application/json;charset=UTF-8", + dataType: "json", + progress: true, + statusCode: { + 200: function (result) { + console.log("[ topMenuApi :: versionPeriod ] :: result"); + console.log(result); + let 버전목록 = result; + let 가장이른시작날짜; + let 가장늦은종료날짜; + if(버전목록.length !== 0) { + for (let i=0; i<버전목록.length; i++) { + + if (i === 0) { + 가장이른시작날짜 = 버전목록[i].c_pds_version_start_date; + 가장늦은종료날짜 = 버전목록[i].c_pds_version_end_date; + } else { + if(버전목록[i]["c_pds_version_start_date"] < 가장이른시작날짜) { + 가장이른시작날짜 = 버전목록[i]["c_pds_version_start_date"]; + } + if(버전목록[i]["c_pds_version_end_date"] > 가장늦은종료날짜) { + 가장늦은종료날짜 = 버전목록[i]["c_pds_version_end_date"]; + } + } + console.log(i); + console.log(가장이른시작날짜); + console.log(가장늦은종료날짜); + } + } + + setVersionPeriod(가장이른시작날짜, 가장늦은종료날짜); + resolve(); + } + } + }); + } + }); }; + var setVersionPeriod = function (earliestDate, latestDate) { + period_date["start_date"] = earliestDate; + period_date["end_date"] = latestDate; + }; + var getVersionPeriod = function () { return period_date; }; @@ -98,20 +140,23 @@ // 요구사항 및 연결&하위 이슈 - Application /////////////////////////////////////// var reqAndSubtaskIssue = function (pdService_id, pdServiceVersionLinks) { - $.ajax({ - url: "/auth-user/api/arms/analysis/scope/top-menu/issue/reqAndSubtask" +pdService_id, - type: "GET", - data: { pdServiceVersionLinks: pdServiceVersionLinks }, - contentType: "application/json;charset=UTF-8", - dataType: "json", - progress: true, - statusCode: { - 200: function (result) { - console.log("[ topMenuApi :: reqAndSubtaskIssue ] :: result"); - console.log(result); - setReqAndSubtaskIssue(result); + return new Promise((resolve, reject) => { + $.ajax({ + url: "/auth-user/api/arms/analysis/top-menu/issue/reqAndSubtask/" + pdService_id, + type: "GET", + data: { pdServiceVersionLinks: pdServiceVersionLinks }, + contentType: "application/json;charset=UTF-8", + dataType: "json", + progress: true, + statusCode: { + 200: function(result) { + console.log("[ topMenuApi :: reqAndSubtaskIssue ] :: result"); + console.log(result); + setReqAndSubtaskIssue(result); + resolve(); + } } - } + }); }); }; @@ -125,9 +170,43 @@ return issue; }; + var resourceInfo = function (pdservice_id, pdServiceVersionLinks) { + return new Promise((resolve, reject) => { + $.ajax({ + url: "/auth-user/api/arms/analysis/top-menu/resourceInfo/" + pdservice_id, + type: "GET", + data: { pdServiceVersionLinks: pdServiceVersionLinks }, + contentType: "application/json;charset=UTF-8", + dataType: "json", + progress: true, + statusCode: { + 200: function(result) { + console.log("[ topMenuApi :: resourceInfo ] :: result"); + console.log(result); + setResourceInfo(result); + resolve(); + } + } + }); + }); + }; + + var setResourceInfo = function (result) { + const keyCount = Object.keys(result).length; + resource["total"] = keyCount; + resource["resourceInfo"] = result; + }; + + var getResourceInfo = function() { + return resource; + }; + + return { + pullTotalApi, reqStateData, getReqStateData, versionPeriod, getVersionPeriod, - reqAndSubtaskIssue, getReqAndSubtaskIssue + reqAndSubtaskIssue, getReqAndSubtaskIssue, + resourceInfo, getResourceInfo } })(); //즉시실행 함수 \ No newline at end of file