fo: exceldownload 4본 수정

This commit is contained in:
2026-01-22 11:26:43 +09:00
parent bd5c2f07d3
commit 974d15962c
4 changed files with 104 additions and 22 deletions
+29 -5
View File
@@ -175,11 +175,11 @@ const fetchFlowRateList = async (pageNo: number, pageSize: number, searchYear: s
const tailStr = partCd ? '/' + partCd + '/' + nameCd + '/' + fcltCpct + '/' + operationValue + (fcltyNm && fcltyNm !== '' ? '/' + fcltyNm : '') : '';
const url = '/fclt/flow/' + pageNo + '/' + pageSize + '/' + searchYear + tailStr;
const res = await getFetch('fo', url);
return { data: res.data, count: res.count }
return { data: res.data, count: res.count, status: res.status}
} catch (error) {
console.error('시설정보 유량현황 데이터를 가져오는데 실패했습니다:', error);
console.log(error);
return { data: [], count: 0 };
return { data: [], count: 0, status: 300 };
}
}
@@ -279,8 +279,32 @@ export const flowRateSearchReducer: (set: (fn: (state: FlowRateSearchType) => Fl
isLoading: true,
},
}));
const res = await fetchFlowRateList(pageNo, pageSize, searchYear, partCd, nameCd, fcltCpct, operationValue, fcltyNm);
const data = res.data;
// const res = await fetchFlowRateList(pageNo, pageSize, searchYear, partCd, nameCd, fcltCpct, operationValue, fcltyNm);
//---------
const flowRateList: any[] = [];
const results: any[] = [];
for (let idx = 0; idx < pageSize; idx += 100) {
const tmpPageNo = Math.floor(idx / 100) + 1;
const tmpPageSize = Math.min(100, pageSize - idx);
const result = await fetchFlowRateList( tmpPageNo, tmpPageSize, searchYear, partCd, nameCd, fcltCpct, operationValue, fcltyNm);
results.push(result);
}
console.log(results);
// 결과를 합치기
for (const res of results) {
if (res?.status === 200 && Array.isArray(res?.data)) {
flowRateList.push(...res.data);
}
}
const recordCount = results[0]?.count || 0;
//-------
// const data = res.data;
const data = flowRateList;
const excelDownList: ExcelType[] = [];
const rtnData = data.map((item: flowRateListProps) => {
item.fctCpc = parseFloat(item.fctCpc.toString().replace(/,/g, ''));
@@ -316,7 +340,7 @@ export const flowRateSearchReducer: (set: (fn: (state: FlowRateSearchType) => Fl
FlowRateList: pageSize < 5000 ? {
...state.FlowRateList,
flowRateList: rtnData,
flowRateCount: res.count,
flowRateCount: recordCount,
isLoading: false,
} : {
...state.FlowRateList,
+25 -7
View File
@@ -322,15 +322,33 @@ export const rdiReducer:(set:SetStateFunction)=>RdiActions=(set: SetStateFunctio
fcltCdList.push(item.bscFctCd);
});
const rdiiDetailListRes : any = await fetchFacilityRdiiDetailList(searchYear, fcltCdList);
console.log(rdiiDetailListRes);
// const rdiiDetailListRes : any = await fetchFacilityRdiiDetailList(searchYear, fcltCdList);
//---------
const rainDetailList: Record<string, any[]> = {};
const results: any[] = [];
for (let idx = 0; idx < fcltCdList.length; idx += 100) {
const slicedItems = fcltCdList.slice(idx, idx + 100);
const result = await fetchFacilityRdiiDetailList(searchYear, slicedItems);
results.push(result);
}
//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);
if (!rainDetailList[keyStr]) rainDetailList[keyStr] = [];
rainDetailList[keyStr].push(...(value as any[]));
}
}
}
//-------
// console.log(rdiiDetailListRes);
for (const item of rtnData) {
//const fcltyCd = item.bscFctCd;
//const res: any = await fetchFacilityWaterQltyListHist(searchYear, fcltyCd);
//const rdiiDetailList = res.data.wqltObjs;
const rdiiDetailList = rdiiDetailListRes?.data[item.bscFctCd];
//console.log(rdiiDetailListRes);
// const rdiiDetailList = rdiiDetailListRes?.data[item.bscFctCd];
const rdiiDetailList = rainDetailList[item.bscFctCd];
let rtnWinterInflBod = 0;
let rtnSummerBodInfl = 0;
+9 -5
View File
@@ -4,7 +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";
// import { fetchFacilityRainDetailList } from "../facilityPrecipitation";
export type { TableUpperProps };
/**
@@ -329,8 +329,8 @@ export const sewageOccurReducer: (set: any) => SewageOccurActions = (set: any) =
});
});
const soccurDetailRes: any = await fetchSweageOccurListFlow(searchYear, fcltCdList);
const wtrUsgYmRes: any = await fetchWtrUsgYmList(searchYear, fcltCdList);
// const soccurDetailRes: any = await fetchSweageOccurListFlow(searchYear, fcltCdList);
// const wtrUsgYmRes: any = await fetchWtrUsgYmList(searchYear, fcltCdList);
//---------
const rainDetailList: Record<string, any[]> = {};
@@ -350,7 +350,9 @@ export const sewageOccurReducer: (set: any) => SewageOccurActions = (set: any) =
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[])];
//rainDetailList[keyStr] = [...(rainDetailList[keyStr] || []), ...(value as any[])];
if (!rainDetailList[keyStr]) rainDetailList[keyStr] = [];
rainDetailList[keyStr].push(...(value as any[]));
}
}
}
@@ -358,7 +360,9 @@ export const sewageOccurReducer: (set: any) => SewageOccurActions = (set: any) =
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[])];
// wtrDetailList[keyStr] = [...(wtrDetailList[keyStr] || []), ...(value as any[])];
if (!wtrDetailList[keyStr]) wtrDetailList[keyStr] = [];
wtrDetailList[keyStr].push(...(value as any[]));
}
}
}
+41 -5
View File
@@ -368,13 +368,49 @@ export const underWaterReducer: (set: (fn: (state: UnderWaterType) => UnderWater
});
});
const soccurDetailRes: any = await fetchDetailListFlow(searchYear, fcltCdList);
const wtrUsgYmRes: any = await fetchWtrUsgYmList(searchYear, fcltCdList);
// const soccurDetailRes: any = await fetchDetailListFlow(searchYear, fcltCdList);
// const wtrUsgYmRes: any = await fetchWtrUsgYmList(searchYear, fcltCdList);
//---------
const rainDetailList: Record<string, any[]> = {};
const wtrDetailList: Record<string, any[]> = {};
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 fetchDetailListFlow(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[])];
if (!rainDetailList[keyStr]) rainDetailList[keyStr] = [];
rainDetailList[keyStr].push(...(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[])];
if (!wtrDetailList[keyStr]) wtrDetailList[keyStr] = [];
wtrDetailList[keyStr].push(...(value as any[]));
}
}
}
//-------
for (const item of underWaterPropsList) {
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];
let chungcunSumFlow = 0; // 청천유입량
let sumChungcunDay = 0; // 청천일수