From 3f7aef9ffdcab33be5c78ac3df7c666e7b7502f7 Mon Sep 17 00:00:00 2001 From: YangJinSoo94 Date: Fri, 20 Jun 2025 17:55:25 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B9=97=EB=AC=BC=EC=8B=9C=EC=84=A4=ED=86=B5?= =?UTF-8?q?=EA=B3=84,=20=EC=A4=91=EC=88=98=EB=8F=84=EC=8B=9C=EC=84=A4?= =?UTF-8?q?=ED=86=B5=EA=B3=84=20=EC=83=81=EC=84=B8=EB=8B=A4=EC=9A=B4?= =?UTF-8?q?=EB=A1=9C=EB=93=9C=20-=20=EC=8B=9C=EB=8F=84=20=EC=A0=84?= =?UTF-8?q?=EC=B2=B4=20=ED=95=A9=EA=B3=84=20=ED=96=89=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/stats/rainStat/page.tsx | 13 ++++++++++++- apps/wr/app/stats/rswtStat/page.tsx | 15 +++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/apps/wr/app/stats/rainStat/page.tsx b/apps/wr/app/stats/rainStat/page.tsx index 8e9722dd7..08990028f 100644 --- a/apps/wr/app/stats/rainStat/page.tsx +++ b/apps/wr/app/stats/rainStat/page.tsx @@ -144,8 +144,19 @@ export default function RainStat() { }); const sidoSummaryList = Array.from(sidoDataMap.values()); + const sidoTotalSummary = [['전체', '', '합계', 0, '', '', 0, '', '', 0, 0, 0, 0, 0, 0, '', 0]]; + sidoSummaryList.forEach((item: (string | number)[]) => { + item.forEach((value: string | number, index: number) => { + if(typeof value === 'number') { + if (sidoTotalSummary[0] && index < sidoTotalSummary[0].length) { + sidoTotalSummary[0][index] = Number(sidoTotalSummary[0][index]) + Number(value); + } + } + }); + }); + // sidoSummaryList와 rainDetailList를 합쳐서 엑셀 데이터 생성 - const excelData = [...sidoSummaryList, ...summaryExcelData]; + const excelData = [...sidoTotalSummary, ...sidoSummaryList, ...summaryExcelData]; excelDownload( excelData as unknown as [][], diff --git a/apps/wr/app/stats/rswtStat/page.tsx b/apps/wr/app/stats/rswtStat/page.tsx index 427df07fb..c0741433c 100644 --- a/apps/wr/app/stats/rswtStat/page.tsx +++ b/apps/wr/app/stats/rswtStat/page.tsx @@ -113,7 +113,7 @@ export default function RswtStat() { } sidoDetailMap.get(sidoText)!.push(item as unknown as (string | number)[]); } - + // 시도별 합계 데이터 수집 if (sidoText && !sidoList.has(sidoText)) { sidoList.add(sidoText); @@ -197,8 +197,19 @@ export default function RswtStat() { }); const sidoSummaryList = Array.from(sidoDataMap.values()); + const sidoTotalSummary = [['전체', '', '합계', 0, '', '', 0, '', '', 0, 0, 0, 0, 0, 0, '', 0]]; + sidoSummaryList.forEach((item: (string | number)[]) => { + item.forEach((value: string | number, index: number) => { + if(typeof value === 'number') { + if (sidoTotalSummary[0] && index < sidoTotalSummary[0].length) { + sidoTotalSummary[0][index] = Number(sidoTotalSummary[0][index]) + Number(value); + } + } + }); + }); + // sidoSummaryList와 rainDetailList를 합쳐서 엑셀 데이터 생성 - const excelData = [...sidoSummaryList, ...summaryExcelData]; + const excelData = [...sidoTotalSummary,...sidoSummaryList, ...summaryExcelData]; excelDownload( excelData as unknown as [][],