diff --git a/apps/fo/app/store/sewageOccur/index.tsx b/apps/fo/app/store/sewageOccur/index.tsx index 5651fed64..748610767 100644 --- a/apps/fo/app/store/sewageOccur/index.tsx +++ b/apps/fo/app/store/sewageOccur/index.tsx @@ -144,7 +144,7 @@ const tempSewageOccurList:modalTableType[] = [] // return res; // } -// 시설정보 RDII 상세 [{BOD - inflAssctBfrWqltBod, 유입유량 inflAmnt, 강우량 infoRnDay, 측정일 msrDt}] +// 시설들 유량 정보 조회 export const fetchSweageOccurListFlow = async (searchYear: string|undefined, fcltCdList: string[]): Promise => { try { const res = await postFetch('fo', '/fclt/flow/'+searchYear, fcltCdList); @@ -154,6 +154,17 @@ export const fetchSweageOccurListFlow = async (searchYear: string|undefined, fcl return null; } }; +// 시설별 물사용량 정보 조회 +export const fetchWtrUsgListFlow = async (searchYear: string|undefined, fcltCdList: string[]): Promise => { + try { + const res = await postFetch('fo', '/fclt/flow/wtrUsg/'+searchYear, fcltCdList); + return res; + } catch (error) { + console.error('시설정보 물사용량 데이터를 가져오는데 실패했습니다:', error); + return null; + } + +}; /**==================================== * Store - expaort @@ -291,8 +302,11 @@ export const sewageOccurReducer:(set:any)=>SewageOccurActions=(set: any) => { }); const soccurDetailRes : any = await fetchSweageOccurListFlow(searchYear, fcltCdList); - console.log(soccurDetailRes); - + const wtrUsgRes : any = await fetchWtrUsgListFlow(searchYear, fcltCdList); + const wtrUsgMap : Record = {}; + wtrUsgRes.data.forEach(fclt => { + wtrUsgMap[fclt.bscFctCd] = fclt.wtrUsg; + }); for (const item of sewageOccurPropsList) { const detailList = soccurDetailRes?.data[item.bscFctCd] @@ -319,7 +333,9 @@ export const sewageOccurReducer:(set:any)=>SewageOccurActions=(set: any) => { const count = detailList ? detailList.length : 0; const avg = count == 0 ? 0 : totWaterUsage / count; // 일평균 유입량 - item.waterUsage = parseFloat((avg * 0.65).toFixed(2)); // 물사용량 = 일평균 유입량 * 65% + if(wtrUsgMap && wtrUsgMap[item.bscFctCd]) { + item.waterUsage = wtrUsgMap[item.bscFctCd]; + } else {item.waterUsage = parseFloat((avg * 0.65).toFixed(2));} // 물사용량 = 일평균 유입량 * 65% item.sewageInputYear = parseFloat(avg.toFixed(2)); // 연간 하수유입량(m³/일) item.sewageInputChungchun = parseFloat((chungcunSumFlow===0?0:(chungcunSumFlow / sumChungcunDay)).toFixed(2)); // 청천시 하수유입량 item.estimationSewage = parseFloat((item.waterUsage * (item.swageChangePercent/100)).toFixed(2)); // 오수발생량 추정(m³/일)