diff --git a/src/main/java/com/dbnt/faisp/fpiMgt/affair/AffairController.java b/src/main/java/com/dbnt/faisp/fpiMgt/affair/AffairController.java index f61fe493..8274147b 100644 --- a/src/main/java/com/dbnt/faisp/fpiMgt/affair/AffairController.java +++ b/src/main/java/com/dbnt/faisp/fpiMgt/affair/AffairController.java @@ -259,10 +259,18 @@ public class AffairController { // 첩보수집활동 > 외사경찰 견문관 totalList.add(total); } mav.addObject("totalList", totalList); - type1List = addTotalRow(typeStatistics.getCategory1(), type1List); - type2List = addTotalRow(typeStatistics.getCategory2(), type2List); - type3List = addTotalRow(typeStatistics.getCategory3(), type3List); - type4List = addTotalRow(typeStatistics.getCategory4(), type4List); + if(typeStatistics.getCategory1() != null) { + type1List = addTotalRow(typeStatistics.getCategory1(), type1List); + } + if(typeStatistics.getCategory2() != null) { + type2List = addTotalRow(typeStatistics.getCategory2(), type2List); + } + if(typeStatistics.getCategory3() != null) { + type3List = addTotalRow(typeStatistics.getCategory3(), type3List); + } + if(typeStatistics.getCategory4() != null) { + type4List = addTotalRow(typeStatistics.getCategory4(), type4List); + } mav.addObject("type1List", type1List); mav.addObject("type2List", type2List); mav.addObject("type3List", type3List); @@ -287,8 +295,12 @@ public class AffairController { // 첩보수집활동 > 외사경찰 견문관 } totalList.add(total); } - sangboCntList = addTotalRow(typeStatistics.getSangbo(), sangboCntList); - arrCntList = addTotalRow(typeStatistics.getRating(), arrCntList); + if(typeStatistics.getSangbo() != null) { + sangboCntList = addTotalRow(typeStatistics.getSangbo(), sangboCntList); + } + if(typeStatistics.getRating() != null) { + arrCntList = addTotalRow(typeStatistics.getRating(), arrCntList); + } mav.addObject("totalList", totalList); mav.addObject("sangboList", sangboCntList); mav.addObject("arrCntList", arrCntList); diff --git a/src/main/resources/mybatisMapper/AffairMapper.xml b/src/main/resources/mybatisMapper/AffairMapper.xml index 1873f043..f26fc49b 100644 --- a/src/main/resources/mybatisMapper/AffairMapper.xml +++ b/src/main/resources/mybatisMapper/AffairMapper.xml @@ -126,21 +126,21 @@ and wrt_dt <= #{endDate}::date+1 - and affair_key in ( + and ab.affair_key in ( select affair_key - from affair_rating aa - inner join organ_config ab - on aa.rating_organ = ab.organ_cd + from affair_rating ar2 + inner join organ_config oc2 + on ar2.rating_organ = oc2.organ_cd - and aa.affair_rate in + and ar2.affair_rate in #{item} - and aa.organ_up = 'T' - and ab.organ_type in + and ar2.organ_up = 'T' + and oc2.organ_type in #{item} @@ -230,40 +230,42 @@ order by item_cd asc) a left outer join (select wrt_organ, count(*) as cnt - from affair_board - - - and wrt_user_nm like '%'||#{userNm}||'%' - - - and wrt_dt >= #{startDate}::date - - - and wrt_dt <= #{endDate}::date+1 - - - and affair_key in ( - select affair_key - from affair_rating aa - inner join organ_config ab - on aa.rating_organ = ab.organ_cd - - - and aa.affair_rate in - - #{item} - - - - and aa.organ_up = 'T' - and ab.organ_type in - - #{item} - - - - ) - + from affair_board ab, + affair_rating ar + where ab.affair_key = ar.affair_key + and (ar.organ_up != 'T' or ar.organ_up is null) + + and wrt_user_nm like '%'||#{userNm}||'%' + + + and wrt_dt >= #{startDate}::date + + + and wrt_dt <= #{endDate}::date+1 + + + and ab.affair_key in ( + select affair_key + from affair_rating ar2 + inner join organ_config oc2 + on ar2.rating_organ = oc2.organ_cd + + + and ar2.affair_rate in + + #{item} + + + + and ar2.organ_up = 'T' + and oc2.organ_type in + + #{item} + + + + ) + and affair_type1 in @@ -288,7 +290,6 @@ #{item} - group by wrt_organ)b on a.item_cd = b.wrt_organ order by wrt_organ asc @@ -322,10 +323,11 @@ (select wrt_organ, affair_type1 as affair_type, count(*) as cnt - from affair_board - + from affair_board ab, + affair_rating ar + where ab.affair_key = ar.affair_key + and (ar.organ_up != 'T' or ar.organ_up is null) - group by wrt_organ,affair_type1) c on a.item_cd = c.affair_type and b.item_cd = c.wrt_organ order by wrt_organ,affair_type asc @@ -359,10 +361,11 @@ (select wrt_organ, affair_type2 as affair_type, count(*) as cnt - from affair_board - + from affair_board ab, + affair_rating ar + where ab.affair_key = ar.affair_key + and (ar.organ_up != 'T' or ar.organ_up is null) - group by wrt_organ,affair_type2) c on a.item_cd = c.affair_type and b.item_cd = c.wrt_organ order by wrt_organ,affair_type asc @@ -396,10 +399,11 @@ (select wrt_organ, affair_type3 as affair_type, count(*) as cnt - from affair_board - + from affair_board ab, + affair_rating ar + where ab.affair_key = ar.affair_key + and (ar.organ_up != 'T' or ar.organ_up is null) - group by wrt_organ,affair_type3) c on a.item_cd = c.affair_type and b.item_cd = c.wrt_organ order by wrt_organ,affair_type asc @@ -433,84 +437,74 @@ (select wrt_organ, affair_type4 as affair_type, count(*) as cnt - from affair_board - + from affair_board ab, + affair_rating ar + where ab.affair_key = ar.affair_key + and (ar.organ_up != 'T' or ar.organ_up is null) - group by wrt_organ,affair_type4) c on a.item_cd = c.affair_type and b.item_cd = c.wrt_organ order by wrt_organ,affair_type asc - - - and ar.organ_up = 'T' - and oc.organ_type in - - #{item} - - - - and oc.organ_type not in ('OGC002','OGC003') - - - - - and affair_type1 in - - #{item} - - - - and affair_type1 not in (select item_cd from code_mgt where category_cd = 'DC01') - - - - - and affair_type2 in - - #{item} - - - - and affair_type2 not in (select item_cd from code_mgt where category_cd = 'DC02') - - - - - and affair_type3 in - - #{item} - - - - and affair_type3 not in (select item_cd from code_mgt where category_cd = 'DC03') - - - - - and affair_type4 in - - #{item} - - - - and affair_type4 not in (select item_cd from code_mgt where category_cd = 'DC04') - - - - - and affair_rate in - + + and wrt_user_nm like '%'||#{userNm}||'%' + + + and wrt_dt >= #{startDate}::date + + + and wrt_dt <= #{endDate}::date+1 + + + and ab.affair_key in ( + select affair_key + from affair_rating ar2 + inner join organ_config oc2 + on ar2.rating_organ = oc2.organ_cd + + + and ar2.affair_rate in + + #{item} + + + + and ar2.organ_up = 'T' + and oc2.organ_type in + + #{item} + + + + ) + + + and affair_type1 in + #{item} - - - and affair_rate not in (select item_cd from code_mgt where category_cd = 'AAR') - - - + + + and affair_type2 in + + #{item} + + + + and affair_type3 in + + #{item} + + + + and affair_type4 in + + #{item} + + + @@ -573,6 +577,7 @@ organ_config oc where ab.affair_key = ar.affair_key and ar.rating_organ = oc.organ_cd + and (ar.organ_up != 'T' or ar.organ_up is null) group by ab.wrt_organ,oc.organ_type) c on a.item_cd = c.wrt_organ and b.organ_type = c.organ_type @@ -609,12 +614,9 @@ ar.affair_rate, count(*) as cnt from affair_board ab, - affair_rating ar, - organ_config oc + affair_rating ar where ab.affair_key = ar.affair_key - and ar.rating_organ = oc.organ_cd - and ar.affair_rate is not null - and ar.affair_rate != '' + and (ar.organ_up != 'T' or ar.organ_up is null) group by ab.wrt_organ,ar.affair_rate) c on c.wrt_organ = a.item_cd and c.affair_rate = b.item_cd diff --git a/src/main/resources/static/js/igActivities/fpiMgt/affair/statistics.js b/src/main/resources/static/js/igActivities/fpiMgt/affair/statistics.js index ac9da5b0..3ed24b53 100644 --- a/src/main/resources/static/js/igActivities/fpiMgt/affair/statistics.js +++ b/src/main/resources/static/js/igActivities/fpiMgt/affair/statistics.js @@ -5,11 +5,29 @@ $(function(){ }); }) -$(document).on('click', '#downExcel', function (){ - exportExcel(); +$(document).on('click', '#fieldDownExcel', function (){ + exportExcel('분야별'); }) -function exportExcel(){ +$(document).on('click', '#ratingDownExcel', function (){ + exportExcel('평가별'); +}) + +function exportExcel(name){ + var excelHandler = { + getExcelFileName : function(){ + return '견문통계'+'_'+name+'_'+getToday()+'.xlsx'; //파일명 + }, + getSheetName : function(){ + return '견문통계'+'_'+name; + }, + getExcelData : function(){ + return document.getElementById('tableData'); //TABLE id + }, + getWorksheet : function(){ + return XLSX.utils.table_to_sheet(this.getExcelData()); + } + } // step 1. workbook 생성 var wb = XLSX.utils.book_new(); @@ -26,21 +44,6 @@ function exportExcel(){ saveAs(new Blob([s2ab(wbout)],{type:"application/octet-stream"}), excelHandler.getExcelFileName()); } -var excelHandler = { - getExcelFileName : function(){ - return '견문통계'+'_'+getToday()+'.xlsx'; //파일명 - }, - getSheetName : function(){ - return 'Table Test Sheet'; //시트명 - }, - getExcelData : function(){ - return document.getElementById('tableData'); //TABLE id - }, - getWorksheet : function(){ - return XLSX.utils.table_to_sheet(this.getExcelData()); - } -} - function s2ab(s) { var buf = new ArrayBuffer(s.length); //convert s to arrayBuffer var view = new Uint8Array(buf); //create uint8array as viewer @@ -89,9 +92,17 @@ function goFieldStatistics(){ } $(document).on('click', '#ratingSearch', function (){ + if($('input:checkbox[name=rating]:checked').length < 1){ + alert("평가항목을 선택해주세요"); + return false; + } goRatingStatistics(); }) $(document).on('click', '#ratingTab', function (){ + if($('input:checkbox[name=rating]:checked').length < 1){ + alert("평가항목을 선택해주세요"); + return false; + } goRatingStatistics(); }) diff --git a/src/main/resources/templates/igActivities/fpiMgt/affair/affairStatistics.html b/src/main/resources/templates/igActivities/fpiMgt/affair/affairStatistics.html index 283f2efb..c784a185 100644 --- a/src/main/resources/templates/igActivities/fpiMgt/affair/affairStatistics.html +++ b/src/main/resources/templates/igActivities/fpiMgt/affair/affairStatistics.html @@ -92,8 +92,8 @@
- 경찰서상보
- 지방청상보 + 경찰서상보
+ 지방청상보
diff --git a/src/main/resources/templates/igActivities/fpiMgt/affair/fieldStatistics.html b/src/main/resources/templates/igActivities/fpiMgt/affair/fieldStatistics.html index 07bc76d8..b8b0c82f 100644 --- a/src/main/resources/templates/igActivities/fpiMgt/affair/fieldStatistics.html +++ b/src/main/resources/templates/igActivities/fpiMgt/affair/fieldStatistics.html @@ -10,7 +10,7 @@
- +
diff --git a/src/main/resources/templates/igActivities/fpiMgt/affair/ratingStatistics.html b/src/main/resources/templates/igActivities/fpiMgt/affair/ratingStatistics.html index 1a99645a..1c22ad6d 100644 --- a/src/main/resources/templates/igActivities/fpiMgt/affair/ratingStatistics.html +++ b/src/main/resources/templates/igActivities/fpiMgt/affair/ratingStatistics.html @@ -10,7 +10,7 @@
- +