@@ -81,7 +184,7 @@ export default function RswtStat() {
diff --git a/apps/wr/app/store/stats/rainStat/index.tsx b/apps/wr/app/store/stats/rainStat/index.tsx
index 059de2b65..d6e48a53e 100644
--- a/apps/wr/app/store/stats/rainStat/index.tsx
+++ b/apps/wr/app/store/stats/rainStat/index.tsx
@@ -139,7 +139,7 @@ export const rainStatActionsExport = (
})
})
- //상세세
+ //상세
const rainDetailList : RainStatProps[] = [];
res.forEach((item:RainStatProps) => {
const utztnUsgArray = new Array();
diff --git a/apps/wr/app/store/stats/rswtStat/excel.tsx b/apps/wr/app/store/stats/rswtStat/excel.tsx
new file mode 100644
index 000000000..d47e0e3fe
--- /dev/null
+++ b/apps/wr/app/store/stats/rswtStat/excel.tsx
@@ -0,0 +1,46 @@
+import type { RswtStatProps } from ".";
+
+export const excelRswtStat = (excelList:RswtStatProps[]) : string[][] => {
+ const excelData: string[][] = [];
+ excelList.forEach((item) => {
+ excelData.push([
+ //시도
+ String(item.ctpvCd) ?? "",
+ //시군구
+ String(item.sggCd) ?? "",
+ //행정구역명
+ String(item.areaNm) ?? "",
+ //건축물명
+ String(item.bdstNm) ?? "",
+ //건축물용도코드(빈칸)
+ //String(item.bdstUsgCd) ?? "",
+ "",
+ //주소
+ String(item.daddr) ?? "",
+ //법적의무대상여부
+ String(item.lawTrgtYn) ?? "",
+ //설치완료일자
+ String(item.instlCmptnDt) ?? "",
+ //가동개시일(빈칸)
+ //String(item.instlCst) ?? "",
+ "",
+ //건축물면적
+ String(item.archArea) ?? "",
+ //처리용량
+ String(item.filtrTrtmfctCpct) ?? "",
+ //물사용량
+ String(item.wtrUsqty) ?? "",
+ //중수도+대체수이용량
+ String(item.rswtAltSum) ?? "",
+ //중수도이용량
+ String(item.rswtrUsqty) ?? "",
+ //대체수이용량
+ String(item.altUswtrUtztnQnt) ?? "",
+ //중수도용도
+ String(item.utztnUsgCd) ?? "",
+ //연간운영비
+ String(item.anlOperCst) ?? "",
+ ]);
+ });
+ return excelData;
+}
\ No newline at end of file
diff --git a/apps/wr/app/store/stats/rswtStat/index.tsx b/apps/wr/app/store/stats/rswtStat/index.tsx
index f1b09354e..4e2a7ecc8 100644
--- a/apps/wr/app/store/stats/rswtStat/index.tsx
+++ b/apps/wr/app/store/stats/rswtStat/index.tsx
@@ -1,9 +1,14 @@
import { fetchType, getFetch } from "@/components/lib/api";
import type { TableUpperProps } from "../../common/type/header";
import { rswtStatHeadListExport } from "./headList";
+import { excelRswtStat } from "./excel";
export type RswtStatProps = {
ctpvCd: string //시도
+ sggCd : string //시군구
+ areaNm: string //행정구역명
+ bdstNm: string //시설명
+ daddr: string //주소
ctpvCnt: string //개소
archArea: number //건축연면적
filtrTrtmfctCpct: number //처리용량
@@ -20,6 +25,9 @@ export type RswtStatProps = {
ithlEtcUswtr: number //기타
anlOperCst: number //연간운영비
guideStats: GuideStatProps[]
+ utztnUsgCd : string //이용코드
+ lawTrgtYn : string //법적의무대상여부
+ instlCmptnDt : string //설치완료일자
}
export type GuideStatProps = {
@@ -40,9 +48,10 @@ const excelDownList: ExcelType[] = [];
export type rswtStatState = {
rswtStat: {
- rswtStatHeadList: TableUpperProps[]
+ rswtStatHeadList: TableUpperProps[];
rswtStatList: RswtStatProps[];
- excelList: ExcelType[]
+ excelList: ExcelType[];
+ rswtDetailList: RswtStatProps[][];
}
}
@@ -52,7 +61,8 @@ export const rswtStatExport: rswtStatState = {
rswtStat: {
rswtStatHeadList: rswtStatHeadListExport,
rswtStatList: [],
- excelList: []
+ excelList: [],
+ rswtDetailList: []
}
}
@@ -62,10 +72,9 @@ export const rswtStatActionsExport: (set: any) => rswtStatActions = (
return {
searchRswtStatList: async (year: string) => {
const res = await getFetch(fetchType.WR, `/reuseChk/reuseWater/stat/${year}`)
-
const rswtStatList: RswtStatProps[] = [];
- let cityArr: any[] = [];
+ const cityArr: any[] = [];
res.forEach((item: RswtStatProps) => {
let obj = cityArr.find((e) => {
return e.ctpvCd == item.ctpvCd
@@ -131,11 +140,27 @@ export const rswtStatActionsExport: (set: any) => rswtStatActions = (
})
})
+ //상세
+ const rswtDetailList : RswtStatProps[] = [];
+ res.forEach((item:RswtStatProps) => {
+ const utztnUsgArray = new Array();
+ item.guideStats.forEach((guideStat) => {
+ utztnUsgArray.push(guideStat.utztnUsgCd);
+ })
+ rswtDetailList.push({
+ ...item,
+ rswtAltSum : item.rswtrUsqty + item.altUswtrUtztnQnt,
+ utztnUsgCd : utztnUsgArray.join(', '),
+ })
+ });
+
+ const excelDetailData = excelRswtStat(rswtDetailList);
set((state: rswtStatState) => ({
rswtStat: {
...state.rswtStat,
rswtStatList: cityArr,
- excelList: excelDownList
+ excelList: excelDownList,
+ rswtDetailList: excelDetailData
}
}));
}
diff --git a/apps/wr/public/sample_rswtStats.xlsx b/apps/wr/public/sample_rswtStats.xlsx
new file mode 100644
index 000000000..702c4cec0
Binary files /dev/null and b/apps/wr/public/sample_rswtStats.xlsx differ