From 0b774d635b2bfde0130c8f2bc90767db650d4b15 Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Wed, 25 Oct 2023 17:30:23 +0900 Subject: [PATCH] =?UTF-8?q?=ED=86=B5=EA=B3=84=20=EA=B4=80=EB=A0=A8=20java?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/cokr/xit/fims/stat/Stat.java | 51 +++++++++++++++++++ .../java/cokr/xit/fims/stat/StatItem.java | 37 ++++++++++++++ .../java/cokr/xit/fims/stat/StatQuery.java | 20 ++++++++ .../xit/fims/stat/service/StatService.java | 10 ++++ .../stat/service/bean/StatServiceBean.java | 39 ++++++++++++++ .../xit/fims/stat/web/StatController.java | 29 +++++++++++ .../webapp/WEB-INF/jsp/include/dashboard.jsp | 40 ++++++++------- 7 files changed, 208 insertions(+), 18 deletions(-) create mode 100644 src/main/java/cokr/xit/fims/stat/Stat.java create mode 100644 src/main/java/cokr/xit/fims/stat/StatItem.java create mode 100644 src/main/java/cokr/xit/fims/stat/StatQuery.java create mode 100644 src/main/java/cokr/xit/fims/stat/service/StatService.java create mode 100644 src/main/java/cokr/xit/fims/stat/service/bean/StatServiceBean.java create mode 100644 src/main/java/cokr/xit/fims/stat/web/StatController.java diff --git a/src/main/java/cokr/xit/fims/stat/Stat.java b/src/main/java/cokr/xit/fims/stat/Stat.java new file mode 100644 index 00000000..de00889f --- /dev/null +++ b/src/main/java/cokr/xit/fims/stat/Stat.java @@ -0,0 +1,51 @@ +package cokr.xit.fims.stat; + +import java.util.List; + +import cokr.xit.foundation.data.DataObject; +import lombok.Getter; +import lombok.Setter; + +/**통계 자료 정보 + * @author leebj + */ +@Getter +@Setter +public class Stat { + + /** + * 통계 제목 + */ + private String statTitle; + + /** + * 통계 부 제목 + */ + private String statSubTitle; + + /** + * 복합 항목 명 제목 + */ + private String[] compositeItemNameTitle; + + /** + * 복합 값 제목 + */ + private String[] compositeValueTitle; + + /** + * 집계 여부 + */ + private String groupYn; + + /** + * (집계시)통계 항목 목록 + */ + private List statItems; + + /** + * 결과 목록(현황) + */ + private List resultList; + +} diff --git a/src/main/java/cokr/xit/fims/stat/StatItem.java b/src/main/java/cokr/xit/fims/stat/StatItem.java new file mode 100644 index 00000000..7348faf4 --- /dev/null +++ b/src/main/java/cokr/xit/fims/stat/StatItem.java @@ -0,0 +1,37 @@ +package cokr.xit.fims.stat; + +import java.util.List; + +import cokr.xit.foundation.data.DataObject; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class StatItem { + + /** + * 항목 명 + */ + private String itemName;; + + /** + * 복합 항목 명 + */ + private String[] compositeItemName; + + /** + * 값 + */ + private String value; + + /** + * 복합 값 + */ + private String[] compositeValue; + + /** + * 참조 목록 + */ + private List refList; +} diff --git a/src/main/java/cokr/xit/fims/stat/StatQuery.java b/src/main/java/cokr/xit/fims/stat/StatQuery.java new file mode 100644 index 00000000..04e70ca9 --- /dev/null +++ b/src/main/java/cokr/xit/fims/stat/StatQuery.java @@ -0,0 +1,20 @@ +package cokr.xit.fims.stat; + +import cokr.xit.fims.cmmn.CmmnQuery; + +/**통계 요청 +* +*

상세 설명: +* +*

+* ============ 변경 이력 ============
+* 2023-10-24	leebj 최초 작성
+* ================================
+* 
+*/ +public class StatQuery extends CmmnQuery { + + private static final long serialVersionUID = 1L; + + +} diff --git a/src/main/java/cokr/xit/fims/stat/service/StatService.java b/src/main/java/cokr/xit/fims/stat/service/StatService.java new file mode 100644 index 00000000..373f2e7b --- /dev/null +++ b/src/main/java/cokr/xit/fims/stat/service/StatService.java @@ -0,0 +1,10 @@ +package cokr.xit.fims.stat.service; + +import cokr.xit.fims.stat.Stat; +import cokr.xit.fims.stat.StatQuery; + +public interface StatService { + + Stat getStatistics(StatQuery query); + +} diff --git a/src/main/java/cokr/xit/fims/stat/service/bean/StatServiceBean.java b/src/main/java/cokr/xit/fims/stat/service/bean/StatServiceBean.java new file mode 100644 index 00000000..35e4d805 --- /dev/null +++ b/src/main/java/cokr/xit/fims/stat/service/bean/StatServiceBean.java @@ -0,0 +1,39 @@ +package cokr.xit.fims.stat.service.bean; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +import cokr.xit.fims.crdn.service.CrdnService; +import cokr.xit.fims.excl.service.OpnnSbmsnService; +import cokr.xit.fims.sndb.service.SndngService; +import cokr.xit.fims.stat.Stat; +import cokr.xit.fims.stat.StatQuery; +import cokr.xit.fims.stat.service.StatService; +import cokr.xit.foundation.component.AbstractServiceBean; + +@Service("statService") +public class StatServiceBean extends AbstractServiceBean implements StatService { + + @Resource(name = "crdnService") + private CrdnService crdnService; + + @Resource(name = "opnnSbmsnService") + private OpnnSbmsnService opnnSbmsnService; + + @Resource(name = "sndngService") + private SndngService sndngService; + + + @Override + public Stat getStatistics(StatQuery query) { + Stat stat = new Stat(); + + + + + + return stat; + } + +} diff --git a/src/main/java/cokr/xit/fims/stat/web/StatController.java b/src/main/java/cokr/xit/fims/stat/web/StatController.java new file mode 100644 index 00000000..b35213fd --- /dev/null +++ b/src/main/java/cokr/xit/fims/stat/web/StatController.java @@ -0,0 +1,29 @@ +package cokr.xit.fims.stat.web; + +import javax.annotation.Resource; + +import org.springframework.web.servlet.ModelAndView; + +import cokr.xit.base.web.ApplicationController; +import cokr.xit.fims.stat.Stat; +import cokr.xit.fims.stat.StatQuery; +import cokr.xit.fims.stat.service.StatService; + +/**통계 관리 서비스 웹 컨트롤러.
+ * {웹 컨텍스트}/stat 로 접근할 수 있다. + * @author leebj + */ +public class StatController extends ApplicationController { + + @Resource(name="statService") + private StatService statService; + + public ModelAndView getStatistics(StatQuery query) { + ModelAndView mav = new ModelAndView("jsonView"); + + Stat stat = statService.getStatistics(query); + + mav.addObject("stat", stat); + return mav; + } +} diff --git a/src/main/webapp/WEB-INF/jsp/include/dashboard.jsp b/src/main/webapp/WEB-INF/jsp/include/dashboard.jsp index 1915d360..4160cb38 100644 --- a/src/main/webapp/WEB-INF/jsp/include/dashboard.jsp +++ b/src/main/webapp/WEB-INF/jsp/include/dashboard.jsp @@ -177,45 +177,46 @@ function fnLoadStatisticsData(){ data = { statItems : [ - { itemName : "고정형CCTV", completeCnt : 2, totalCnt : 10}, - { itemName : "도보단속", completeCnt : 2, totalCnt : 3}, - { itemName : "이동형CCTV", completeCnt : 2, totalCnt : 3}, - { itemName : "민원(즉시단속)", completeCnt : 10, totalCnt : 10} + { itemName : "고정형CCTV", compositeValue : [2,10] }, + { itemName : "도보단속", compositeValue : [2,3] }, + { itemName : "이동형CCTV", compositeValue : [2,3] }, + { itemName : "민원(즉시단속)", compositeValue : [10,10] } ] }; fnRenderDashboardContents(data, "card1" , "progressAndTotal"); data = { statItems : [ - { itemName : "등록대상", completeCnt : 45, totalCnt : 50}, - { itemName : "이첩대상", completeCnt : 35, totalCnt : 40} + { itemName : "등록대상", compositeValue : [45,50] }, + { itemName : "이첩대상", compositeValue : [35,40] } ] }; fnRenderDashboardContents(data, "card2" , "progressAndTotal"); data = { statItems : [ - { itemName : "계도장", completeCnt : 4, totalCnt : 10}, - { itemName : "사전통보", completeCnt : 5, totalCnt : 11}, - { itemName : "고지서", completeCnt : 6, totalCnt : 12} + { itemName : "계도장", compositeValue : [4,10] }, + { itemName : "사전통보", compositeValue : [5,11] }, + { itemName : "고지서", compositeValue : [6,12] } ] }; fnRenderDashboardContents(data, "card3" , "progressAndTotal"); data = { statItems : [ - { itemName : "접수", completeCnt : 49, totalCnt : 100}, - { itemName : "수용/미수용", completeCnt : 50, totalCnt : 98}, - { itemName : "자진취하", completeCnt : 51, totalCnt : 97} + { itemName : "접수", compositeValue : [49,100] }, + { itemName : "수용/미수용", compositeValue : [50,98] }, + { itemName : "자진취하", compositeValue : [51,97] } ] }; fnRenderDashboardContents(data, "card4" , "progressAndTotal"); data = { + compositeValueTitle : [14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, "금일"], statItems : [ - { itemName : "고정형", valueByTime : [80, 150, 180, 270, 210, 160, 160, 202, 265, 210, 270, 255, 290, 360, 375] }, - { itemName : "도보", valueByTime : [80, 125, 105, 130, 215, 195, 140, 160, 230, 300, 220, 170, 210, 200, 280] }, - { itemName : "민원", valueByTime : [80, 99, 82, 90, 115, 115, 74, 75, 130, 155, 125, 90, 140, 130, 180] } + { itemName : "고정형", compositeValue : [80, 150, 180, 270, 210, 160, 160, 202, 265, 210, 270, 255, 290, 360, 375] }, + { itemName : "도보", compositeValue : [80, 125, 105, 130, 215, 195, 140, 160, 230, 300, 220, 170, 210, 200, 280] }, + { itemName : "민원", compositeValue : [80, 99, 82, 90, 115, 115, 74, 75, 130, 155, 125, 90, 140, 130, 180] } ] }; fnRenderDashboardContents(data, "lineChart" , "line"); @@ -275,7 +276,7 @@ function fnRenderProgressAndTotal(returnData, cursor){ $("#"+cursor) .find("p") .eq(i) - .html(returnData.statItems[i].completeCnt + "/" + returnData.statItems[i].totalCnt); + .html(returnData.statItems[i].compositeValue[0] + "/" + returnData.statItems[i].compositeValue[1]); } if(cursor == "card1"){ @@ -318,7 +319,7 @@ function fnRenderLine(returnData, cursor){ defaultObject.label = returnData.statItems[i].itemName; - defaultObject.data = returnData.statItems[i].valueByTime; + defaultObject.data = returnData.statItems[i].compositeValue; if(i % 3 == 0){ defaultObject.backgroundColor = config.colors.danger; @@ -338,13 +339,16 @@ function fnRenderLine(returnData, cursor){ datasets.push(defaultObject); } + + var xAxisLabels = returnData.compositeValueTitle; + var lineChart = document.getElementById(cursor); if (lineChart) { var lineChartVar = new Chart(lineChart, { type: 'line', data: { - labels: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], + labels: xAxisLabels, datasets: datasets }, options: {