Merge branch 'iipbs/sn/dev'

This commit is contained in:
dongsilove
2026-01-22 22:03:33 +09:00
6 changed files with 215 additions and 41 deletions
+33 -8
View File
@@ -282,15 +282,19 @@ const upHeadListModalChongIn: TableUpperProps[] = [
====================================*/
// 메인페이지
// 시설정보 수질 리스트 데이터 호출
const fetchFacilityWaterQltyList = async (pageNo: number, pageSize: number, searchYear: string, partCd?: string | undefined, nameCd?: string | undefined, fcltCpct?: string | undefined, operationValue?: string | undefined, fcltyNm?: string | undefined): Promise<{ data: FacilityWaterQltyProps[], count: number }> => {
const fetchFacilityWaterQltyList = async (
pageNo: number, pageSize: number, searchYear: string, partCd?: string | undefined
, nameCd?: string | undefined, fcltCpct?: string | undefined
, operationValue?: string | undefined, fcltyNm?: string | undefined
): Promise<{ data: FacilityWaterQltyProps[], count: number, status: number }> => {
try {
const tailStr = partCd ? '/' + partCd + '/' + nameCd + '/' + fcltCpct + '/' + operationValue + (fcltyNm && fcltyNm !== '' ? '/' + fcltyNm : '') : '';
const url = '/fclt/qlty/' + 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);
return { data: [], count: 0 };
return { data: [], count: 0, status: 300 };
}
}
@@ -457,8 +461,27 @@ export const facilityWaterQltyReducer = (set: SetFunc): FacilityWaterQltyActions
isLoading: true,
},
}));
const res = await fetchFacilityWaterQltyList(pageNo, pageSize, searchYear, part, nameCd, fcltCpct, operationValue, fcltyNm);
const rtnData = res.data.map(item => {
// const res = await fetchFacilityWaterQltyList(pageNo, pageSize, searchYear, part, nameCd, fcltCpct, operationValue, fcltyNm);
//---------
const waterQltyList: any[] = [];
let recordCount = 0;
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 fetchFacilityWaterQltyList(tmpPageNo, tmpPageSize, searchYear, part, nameCd, fcltCpct, operationValue, fcltyNm);
if (result?.status === 200 && Array.isArray(result?.data)) {
waterQltyList.push(...result.data);
}
recordCount = result?.count || 0;
if (result?.count < tmpPageNo * tmpPageSize) {
break; // 더 이상 데이터가 없으면 중지
}
}
//-------
// const rtnData = res.data.map(item => {
const rtnData = waterQltyList.map(item => {
dataFormSetting(item)
if (item.inflAssctBfrWqltTn) {
item.inflAssctBfrWqltTn = Number(Math.round(Number(item.inflAssctBfrWqltTn) * 1000) / 1000).toFixed(3);
@@ -500,7 +523,8 @@ export const facilityWaterQltyReducer = (set: SetFunc): FacilityWaterQltyActions
});
const excelDownList: ExcelType[] = [];
if (pageSize > 5000) {
res.data.forEach(item => {
// res.data.forEach(item => {
waterQltyList.forEach(item => {
dataFormSetting(item)
item.fctCpc = parseFloat(item.fctCpc.toString().replace(/,/g, ''));
item.sidoNm = item.lclgvrnmntNm.split(' ')[0]?.toString() || '';
@@ -531,7 +555,8 @@ export const facilityWaterQltyReducer = (set: SetFunc): FacilityWaterQltyActions
});
});
} else {
res.data.forEach((item: FacilityWaterQltyProps) => {
// res.data.forEach((item: FacilityWaterQltyProps) => {
waterQltyList.forEach((item: FacilityWaterQltyProps) => {
dataFormSetting(item)
item.fctCpc = parseFloat(item.fctCpc.toString().replace(/,/g, ''));
item.sidoNm = item.lclgvrnmntNm.split(' ')[0]?.toString() || '';
@@ -545,7 +570,7 @@ export const facilityWaterQltyReducer = (set: SetFunc): FacilityWaterQltyActions
FacilityWaterQltyMain: pageSize < 5000 ? {
...state.FacilityWaterQltyMain,
facilityWaterQltyList: rtnData,
facilityWaterQltyCount: res.count,
facilityWaterQltyCount: recordCount,
isLoading: false,
} : {
...state.FacilityWaterQltyMain,
+31 -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,34 @@ 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);
if (result?.count < tmpPageNo * tmpPageSize) {
break; // 더 이상 데이터가 없으면 중지
}
}
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 +342,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,
+41 -8
View File
@@ -4,6 +4,7 @@ import { getFetch, postFetch } from "@/app/components/api";
import { type ApiResponse } from "../underWaterInput";
// import CalcRainEffect from "@/app/components/common/CalcRainEffect";
import { roundUp } from "../common";
// import { fetchSweageOccurListFlow, fetchWtrUsgYmList } from "../sewageOccur";
export type { TableUpperProps };
/**
* 처리시설 연간 운영현황 > 계획하수량 산정지표 현황
@@ -101,14 +102,15 @@ const planSewageList: PlanSewageProps[] = [
* @param oprtngSttsCd : 운영 상태 코드
* @param facilityName : 시설명
*/
const fetchPlanSewageList = async (pageNo: number, pageSize: number, searchYear: string, partCd?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => {
const fetchPlanSewageList = async (pageNo: number, pageSize: number, searchYear: string, partCd?: string, nameCd?: string
, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => {
const tailStr = partCd ? '/' + partCd + '/' + (nameCd || '0') + '/' + (fcltCpct || '0') + '/' + (operationValue || '0') + '/0' + (fcltyNm && fcltyNm !== '' ? '/' + fcltyNm : '') : '';
const url = '/prcsFclt/info/plan/' + pageNo + '/' + pageSize + '/' + searchYear + tailStr;
const res = await getFetch('fo', url);
return { data: res.data, count: res.count }
}
// 분류식화율 구하기 위한 api 호출
// 분류식화율 구하기 위한 api 호출 : 분류식화율 = 분류식지역 면적(㎢) / 처리​구역 면적합계(㎢) × 100
const fetchPlanZoneList = async (searchYear: string, fcltCdList: string[]) => {
try {
const res = await postFetch('fo', '/prcsFclt/info/planZone/' + searchYear, fcltCdList);
@@ -251,19 +253,50 @@ export const planSewageReducer: (set: (fn: (state: PlanSewageType) => PlanSewage
const excelDownList: ExcelType[] = [];
// const data = res.data
const planZoneRes: any = await fetchPlanZoneList(searchYear, fcltCdList);
const planZoneList = planZoneRes?.data;
// 분류식화율 구하기 위한 api 호출 : 분류식화율 = 분류식지역 면적(㎢) / 처리​구역 면적합계(㎢) × 100
// const planZoneRes: any = await fetchPlanZoneList(searchYear, fcltCdList);
// const detailRes: any = await fetchFlow(searchYear, fcltCdList);
//---------
const planZoneList: any[] = [];
const flowDetailList: Record<string, any[]> = {};
// const results: any[] = [];
const flowDetailResults: any[] = [];
for (let idx = 0; idx < fcltCdList.length; idx += 100) {
const slicedItems = fcltCdList.slice(idx, idx + 100);
const result = await fetchPlanZoneList(searchYear, slicedItems); // 분류식화율 구하기 위한 api 호출 : 분류식화율 = 분류식지역 면적(㎢) / 처리​구역 면적합계(㎢) × 100
const flowResult = await fetchFlow(searchYear, slicedItems);
if (result?.status === 200 && Array.isArray(result?.data)) {
planZoneList.push(...result.data);
}
flowDetailResults.push(flowResult);
}
//console.log(results);
// 결과를 합치기
for (const res of flowDetailResults) {
if (res.status === 200 && res.data) {
for (const [key, value] of Object.entries(res.data)) {
const keyStr = String(key);
if (!flowDetailList[keyStr]) flowDetailList[keyStr] = [];
flowDetailList[keyStr].push(...(value as any[]));
}
}
}
//-------
// const planZoneList = planZoneRes?.data;
planZoneList?.forEach(item => {
const planSewageItem = planSewageList.find(item2 => item2.bscFctCd == item.bscFctCd);
if (planSewageItem) {
planSewageItem.sprtProcZoneAr = item.sprtProcZoneAr;
planSewageItem.procZoneSm = item.procZoneSm;
planSewageItem.sprtProcZoneAr = item.sprtProcZoneAr; // 처리구역면적_분류식
planSewageItem.procZoneSm = item.procZoneSm; //처리구역면적합계
}
});
const detailRes: any = await fetchFlow(searchYear, fcltCdList);
//const detailRes: any = await fetchFlow(searchYear, fcltCdList);
for (const item of planSewageList) {
const detailList = detailRes?.data[item.bscFctCd];
// const detailList = detailRes?.data[item.bscFctCd];
const detailList = flowDetailList[item.bscFctCd];
let avgInflAmnt = 0;
let sumInflAmntSunny = 0;
+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;
+44 -8
View File
@@ -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 };
/**
@@ -328,17 +329,52 @@ 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<string, number> = {};
// wtrUsgRes.data.forEach(fclt => {
// wtrUsgMap[fclt.bscFctCd] = fclt.wtrUsg;
// });
// const soccurDetailRes: any = await fetchSweageOccurListFlow(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 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[])];
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[]));
}
}
}
//-------
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; // 청천일수
+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; // 청천일수