fo:물사용량 조회 api추가
This commit is contained in:
@@ -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<SewageOccurProps | null> => {
|
||||
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<SewageOccurProps | null> => {
|
||||
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<string, number> = {};
|
||||
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³/일)
|
||||
|
||||
Reference in New Issue
Block a user