From bd5c2f07d389d99a734fd789f3d04f63dd282af5 Mon Sep 17 00:00:00 2001 From: dongsilove Date: Wed, 21 Jan 2026 22:15:02 +0900 Subject: [PATCH] =?UTF-8?q?fo:=20=EC=98=A4=EC=88=98=EB=B0=9C=EC=83=9D?= =?UTF-8?q?=EB=9F=89=20=EC=88=98=EC=A0=95=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/fo/app/store/sewageOccur/index.tsx | 44 +++++++++++++++++++++---- 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/apps/fo/app/store/sewageOccur/index.tsx b/apps/fo/app/store/sewageOccur/index.tsx index 1f4e8ce7e..a0ff0a3f3 100644 --- a/apps/fo/app/store/sewageOccur/index.tsx +++ b/apps/fo/app/store/sewageOccur/index.tsx @@ -4,6 +4,7 @@ import { roundNumber } from "@/app/components/common/DataForm"; import { OSU_PERCENT } from "../common"; import type { TableUpperProps } from "../dashboard"; import { fetchFacilityListInit } from "../processFacility"; +import { fetchFacilityRainDetailList } from "../facilityPrecipitation"; export type { TableUpperProps }; /** @@ -330,15 +331,46 @@ export const sewageOccurReducer: (set: any) => SewageOccurActions = (set: any) = const soccurDetailRes: any = await fetchSweageOccurListFlow(searchYear, fcltCdList); const wtrUsgYmRes: any = await fetchWtrUsgYmList(searchYear, fcltCdList); - // const wtrUsgMap : Record = {}; - // wtrUsgRes.data.forEach(fclt => { - // wtrUsgMap[fclt.bscFctCd] = fclt.wtrUsg; - // }); + + //--------- + const rainDetailList: Record = {}; + const wtrDetailList: Record = {}; + const results: any[] = []; + const wtrResults: any[] = []; + for (let idx = 0; idx < fcltCdList.length; idx += 100) { + const slicedItems = fcltCdList.slice(idx, idx + 100); + const result = await fetchSweageOccurListFlow(searchYear, slicedItems); + const wtrResult = await fetchWtrUsgYmList(searchYear, slicedItems); + results.push(result); + wtrResults.push(wtrResult); + } + //console.log(results); + // 결과를 합치기 + for (const res of results) { + if (res.status === 200 && res.data) { + for (const [key, value] of Object.entries(res.data)) { + const keyStr = String(key); + rainDetailList[keyStr] = [...(rainDetailList[keyStr] || []), ...(value as any[])]; + } + } + } + for (const res of wtrResults) { + if (res.status === 200 && res.data) { + for (const [key, value] of Object.entries(res.data)) { + const keyStr = String(key); + wtrDetailList[keyStr] = [...(wtrDetailList[keyStr] || []), ...(value as any[])]; + } + } + } + //------- + let maxEstimationSewage = 0, minEstimationSewage = 999999999; for (const item of sewageOccurPropsList) { - const detailList = soccurDetailRes?.data[item.bscFctCd]; - const wtrUsgYmList = wtrUsgYmRes?.data[item.bscFctCd]; + //const detailList = soccurDetailRes?.data[item.bscFctCd]; + // const wtrUsgYmList = wtrUsgYmRes?.data[item.bscFctCd]; + const detailList = rainDetailList[item.bscFctCd]; + const wtrUsgYmList = wtrDetailList[item.bscFctCd]; item.swageChangePercent = 90; let sumChungcunDay = 0; // 청천일수