From 178b8bd78241d354836ce41f883cae693bcf0bdc Mon Sep 17 00:00:00 2001 From: ljpark Date: Tue, 11 Nov 2025 18:11:30 +0900 Subject: [PATCH 1/4] =?UTF-8?q?fo=20=EC=9E=91=EC=97=85=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/store/facilityPrecipitation/index.tsx | 59 ++++++++++--------- 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/apps/fo/app/store/facilityPrecipitation/index.tsx b/apps/fo/app/store/facilityPrecipitation/index.tsx index f7a716349..75e9042bd 100644 --- a/apps/fo/app/store/facilityPrecipitation/index.tsx +++ b/apps/fo/app/store/facilityPrecipitation/index.tsx @@ -136,39 +136,42 @@ const gridListPrecipitationDetail:PrecipitationPropsDetailProps[] = [ const fetchFacilityPrecipitationList = async (pageNo: number, pageSize: number, searchYear: string, part?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => { const tailStr = '/'+pageNo + '/' + pageSize + '/' + searchYear + (part?'/' + part:'' ) + (nameCd?'/' + nameCd:'' ) + (fcltCpct?'/' + fcltCpct:'' ) + (operationValue?'/' + operationValue:'' ) + (fcltyNm && fcltyNm !== '' ? '/' + fcltyNm : '') ; - const url = '/fclt/rain' + tailStr; + // const url = '/fclt/rain' + tailStr; + const url = '/rdii/list' + tailStr; const res = await getFetch('fo', url); - const tmpData:PrecipitationPropsDetailProps[] = []; - if(res!= null && res.data.length > 0){ - for(let idx=0; idx=3?1:0; + // const tmpData:PrecipitationPropsDetailProps[] = []; + // if(res!= null && res.data.length > 0){ + // for(let idx=0; idx=3?1:0; - tmpData.push({ - bscFctCd : bscFctCd, - rainDt : rainDt, - infoRnDay : infoRnDay, - rainDay : rainDay, - rainEffectDay : rainDay - }) - } - } + // tmpData.push({ + // bscFctCd : bscFctCd, + // rainDt : rainDt, + // infoRnDay : infoRnDay, + // rainDay : rainDay, + // rainEffectDay : rainDay + // }) + // } + // } - res.data.map((item: FacilityPrecipitationProps) => { - const filteredList = tmpData.filter((gridItem) => { - return gridItem.bscFctCd === item.bscFctCd; - }); + // res.data.map((item: FacilityPrecipitationProps) => { + // const filteredList = tmpData.filter((gridItem) => { + // return gridItem.bscFctCd === item.bscFctCd; + // }); - const rtnData = CalcRainEffect(filteredList); - item.rainEffectDay = rtnData.reduce((acc, curr) => acc + curr.rainEffectDay, 0); - item.totalYearRain = rtnData.reduce((acc, curr) => acc + Number(curr.infoRnDay), 0); - item.infoRnDay = filteredList.reduce((acc, curr) => acc + curr.rainDay, 0); - }); + // const rtnData = CalcRainEffect(filteredList); + // item.rainEffectDay = rtnData.reduce((acc, curr) => acc + curr.rainEffectDay, 0); // 강우영향일 + // item.totalYearRain = rtnData.reduce((acc, curr) => acc + Number(curr.infoRnDay), 0); // 연간 총 강수량 + // item.infoRnDay = filteredList.reduce((acc, curr) => acc + curr.rainDay, 0); // 강우일 + // }); - } + // } + + return { data: res.data, count: res.count, detailData: tmpData }; } From 81b027cfe1151493b68ba4b01788349ad36184d6 Mon Sep 17 00:00:00 2001 From: dongsilove Date: Wed, 12 Nov 2025 00:00:18 +0900 Subject: [PATCH 2/4] =?UTF-8?q?fo=20=EC=88=98=EC=A0=95=EC=A4=912?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/store/facilityPrecipitation/index.tsx | 110 ++++++++++++------ 1 file changed, 75 insertions(+), 35 deletions(-) diff --git a/apps/fo/app/store/facilityPrecipitation/index.tsx b/apps/fo/app/store/facilityPrecipitation/index.tsx index 75e9042bd..f4462c4c2 100644 --- a/apps/fo/app/store/facilityPrecipitation/index.tsx +++ b/apps/fo/app/store/facilityPrecipitation/index.tsx @@ -1,4 +1,4 @@ -import { getFetch } from "@/app/components/api"; +import { getFetch, postFetch } from "@/app/components/api"; import CalcRainEffect from "@/app/components/common/CalcRainEffect"; import { roundNumber } from "@/app/components/common/DataForm"; import type { TableUpperProps } from "../dashboard"; @@ -130,50 +130,90 @@ const upHeadListPrecipitationDetail:TableUpperProps[] = [ const gridListPrecipitationDetail:PrecipitationPropsDetailProps[] = [ ] +export interface FacilityRainDetailProps { + bscFctCd: string, // 시설코드 + msrDt: string, // 측정일 + stnKo: string, // 관측소명 + infoRnDay: number | string | '', // 강수량 (mm/일) + rainDay: number, // 강우일 (일) + rainEffectDay: number, // 강우영향일 (일) +} + /**==================================== * Store - api ====================================*/ +// 시설정보 목록 [] +export const fetchFacilityRainDetailList = async (searchYear: string|undefined, fcltCdList: string[]): Promise => { + try { + const res = await postFetch('fo', '/fclt/rain/detail/'+searchYear, fcltCdList); + return res; + } catch (error) { + console.error('시설정보 목록 데이터를 가져오는데 실패했습니다:', error); + return null; + } +}; const fetchFacilityPrecipitationList = async (pageNo: number, pageSize: number, searchYear: string, part?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => { const tailStr = '/'+pageNo + '/' + pageSize + '/' + searchYear + (part?'/' + part:'' ) + (nameCd?'/' + nameCd:'' ) + (fcltCpct?'/' + fcltCpct:'' ) + (operationValue?'/' + operationValue:'' ) + (fcltyNm && fcltyNm !== '' ? '/' + fcltyNm : '') ; // const url = '/fclt/rain' + tailStr; const url = '/rdii/list' + tailStr; const res = await getFetch('fo', url); - // const tmpData:PrecipitationPropsDetailProps[] = []; - // if(res!= null && res.data.length > 0){ - // for(let idx=0; idx=3?1:0; - - // tmpData.push({ - // bscFctCd : bscFctCd, - // rainDt : rainDt, - // infoRnDay : infoRnDay, - // rainDay : rainDay, - // rainEffectDay : rainDay - // }) - // } - // } - - // res.data.map((item: FacilityPrecipitationProps) => { - // const filteredList = tmpData.filter((gridItem) => { - // return gridItem.bscFctCd === item.bscFctCd; - // }); - - // const rtnData = CalcRainEffect(filteredList); - // item.rainEffectDay = rtnData.reduce((acc, curr) => acc + curr.rainEffectDay, 0); // 강우영향일 - // item.totalYearRain = rtnData.reduce((acc, curr) => acc + Number(curr.infoRnDay), 0); // 연간 총 강수량 - // item.infoRnDay = filteredList.reduce((acc, curr) => acc + curr.rainDay, 0); // 강우일 - // }); - - // } - - - return { data: res.data, count: res.count, detailData: tmpData }; + + const fcltCdList : string[]= []; + res?.data.forEach(item => { + fcltCdList.push(item.bscFctCd); + }); + + const rainDetailListRes : any = await fetchFacilityRainDetailList(searchYear, fcltCdList); + const tmpData:PrecipitationPropsDetailProps[] = []; + + for (const item of res?.data) { + const rainDetailList = rainDetailListRes?.data[item.bscFctCd]; + + let rainDayCnt = 0; // 강우일수 + let rainEffectDayCnt = 0; // 강우영향일수 + let totalRain = 0; // 총강수량 + if (rainDetailList) { + item.stnKo = rainDetailList[0]?.stnKo || ''; // 관측소명 + + let rainEffectDayEval = 0; // 강우영향일 평가 변수 + rainDetailList.forEach(item2 => { + + if (item2.infoRnDay == null) item2.infoRnDay = 0; + if (item2.infoRnDay >= 3) { // 강우량이 3mm 이상인 경우 강우일 + rainEffectDayEval = 2; + item2.rainDay = 1; + rainDayCnt++; // 강우일수 증가 + } else { + rainEffectDayEval--; + item2.rainDay = 0; + } + + if (rainEffectDayEval < 0) { // 청천일 + item2.rainEffectDay = 0; + } else { // 강우영향일 + item2.rainEffectDay = 1; + rainEffectDayCnt++; // 강우영향일수 증가 + } + totalRain += Number(item2.infoRnDay); + item2.rainDt = item2.msrDt; + tmpData.push({ + bscFctCd: item.bscFctCd, + rainDt: item2.msrDt, + infoRnDay: item2.infoRnDay, + rainEffectDay: item2.rainEffectDay, + rainDay: item2.rainDay + }); + }); + item.infoRnDay = rainDayCnt; + item.rainEffectDay = rainEffectDayCnt; + item.totalYearRain = totalRain; + item.rainDetailList = rainDetailList; + } + } + + return { data: res.data, count: res.count, detailData: tmpData}; } /**==================================== From 8259b3829afae06cd7b72f84933eb13ba63b6ca0 Mon Sep 17 00:00:00 2001 From: ljpark Date: Wed, 12 Nov 2025 15:10:51 +0900 Subject: [PATCH 3/4] =?UTF-8?q?=EA=B0=95=EC=88=98=ED=98=84=ED=99=A9=20exce?= =?UTF-8?q?ldown=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/store/facilityPrecipitation/index.tsx | 37 ++++++++++++++----- apps/fo/app/store/rdi/index.tsx | 14 ++++--- .../matMng/coMng/drgtSttn/page.tsx | 9 +++++ 3 files changed, 46 insertions(+), 14 deletions(-) diff --git a/apps/fo/app/store/facilityPrecipitation/index.tsx b/apps/fo/app/store/facilityPrecipitation/index.tsx index f4462c4c2..39bc35220 100644 --- a/apps/fo/app/store/facilityPrecipitation/index.tsx +++ b/apps/fo/app/store/facilityPrecipitation/index.tsx @@ -1,5 +1,5 @@ import { getFetch, postFetch } from "@/app/components/api"; -import CalcRainEffect from "@/app/components/common/CalcRainEffect"; +//import CalcRainEffect from "@/app/components/common/CalcRainEffect"; import { roundNumber } from "@/app/components/common/DataForm"; import type { TableUpperProps } from "../dashboard"; export type { TableUpperProps }; @@ -132,7 +132,7 @@ const gridListPrecipitationDetail:PrecipitationPropsDetailProps[] = [ export interface FacilityRainDetailProps { bscFctCd: string, // 시설코드 - msrDt: string, // 측정일 + rainDt: string, // 측정일 stnKo: string, // 관측소명 infoRnDay: number | string | '', // 강수량 (mm/일) rainDay: number, // 강우일 (일) @@ -155,8 +155,7 @@ export const fetchFacilityRainDetailList = async (searchYear: string|undefined, const fetchFacilityPrecipitationList = async (pageNo: number, pageSize: number, searchYear: string, part?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => { const tailStr = '/'+pageNo + '/' + pageSize + '/' + searchYear + (part?'/' + part:'' ) + (nameCd?'/' + nameCd:'' ) + (fcltCpct?'/' + fcltCpct:'' ) + (operationValue?'/' + operationValue:'' ) + (fcltyNm && fcltyNm !== '' ? '/' + fcltyNm : '') ; - // const url = '/fclt/rain' + tailStr; - const url = '/rdii/list' + tailStr; + const url = '/fclt/rain' + tailStr; const res = await getFetch('fo', url); @@ -165,11 +164,31 @@ const fetchFacilityPrecipitationList = async (pageNo: number, pageSize: number, fcltCdList.push(item.bscFctCd); }); - const rainDetailListRes : any = await fetchFacilityRainDetailList(searchYear, fcltCdList); + const rainDetailListRes: Record = {}; + const promises: Promise[] = []; + for (let idx = 0; idx < fcltCdList.length; idx += 100) { + const slicedItems = fcltCdList.slice(idx, idx + 100); + // 각 fetch 호출을 Promise 배열에 담기 + promises.push(fetchFacilityRainDetailList(searchYear, slicedItems)); + } + // 모든 요청을 병렬로 실행 + const results = await Promise.all(promises); + //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); + rainDetailListRes[keyStr] = [...(rainDetailListRes[keyStr] || []), ...(value as any[])]; + } + } + } + //console.log(rainDetailListRes); + const tmpData:PrecipitationPropsDetailProps[] = []; for (const item of res?.data) { - const rainDetailList = rainDetailListRes?.data[item.bscFctCd]; + const rainDetailList = rainDetailListRes[item.bscFctCd]; let rainDayCnt = 0; // 강우일수 let rainEffectDayCnt = 0; // 강우영향일수 @@ -197,10 +216,10 @@ const fetchFacilityPrecipitationList = async (pageNo: number, pageSize: number, rainEffectDayCnt++; // 강우영향일수 증가 } totalRain += Number(item2.infoRnDay); - item2.rainDt = item2.msrDt; + item2.rainDt = item2.rainDt; tmpData.push({ bscFctCd: item.bscFctCd, - rainDt: item2.msrDt, + rainDt: item2.rainDt.substring(0,10), infoRnDay: item2.infoRnDay, rainEffectDay: item2.rainEffectDay, rainDay: item2.rainDay @@ -211,7 +230,7 @@ const fetchFacilityPrecipitationList = async (pageNo: number, pageSize: number, item.totalYearRain = totalRain; item.rainDetailList = rainDetailList; } - } + } return { data: res.data, count: res.count, detailData: tmpData}; } diff --git a/apps/fo/app/store/rdi/index.tsx b/apps/fo/app/store/rdi/index.tsx index 6fd287432..92cedd301 100644 --- a/apps/fo/app/store/rdi/index.tsx +++ b/apps/fo/app/store/rdi/index.tsx @@ -184,8 +184,10 @@ const fetchRdiList = async (pageNo: number, pageSize: number, searchYear: string item.rdiiValue = ''; item.infoRnDay = ''; item.properYn = ''; - item.sido = item.lclgvrnmntNm.split(' ')[0]?.toString() || ''; - item.sigungo = item.lclgvrnmntNm.split(' ')[1]?.toString() || ''; + // item.sido = item.lclgvrnmntNm.split(' ')[0]?.toString() || ''; + // item.sigungo = item.lclgvrnmntNm.split(' ')[1]?.toString() || ''; + item.sido = item.sido; + item.sigungo = item.gugun; }); return { data: res.data, count: res.count } }catch(error){ @@ -307,8 +309,10 @@ export const rdiReducer:(set:SetStateFunction)=>RdiActions=(set: SetStateFunctio const rtnData = res.data.map((item: RdiProps) => { return { ...item, - sido: item.lclgvrnmntNm.split(' ')[0]?.toString() || '', - sigungo: item.lclgvrnmntNm.split(' ')[1]?.toString() || '', + //sido: item.lclgvrnmntNm.split(' ')[0]?.toString() || '', + //sigungo: item.lclgvrnmntNm.split(' ')[1]?.toString() || '', + sido: item.sido, + sigungo : item.gugun, inflAmnt: item.inflAmnt?Number(item.inflAmnt).toFixed(1): '' // 유입유량 (강우량) } }) @@ -427,7 +431,7 @@ export const rdiReducer:(set:SetStateFunction)=>RdiActions=(set: SetStateFunctio 환경청: item.rgnNm, 시설명: item.bscFctNm, 시도: item.sido, - 시군구: item.sigungo, + 시군구: item.gugun, 주소: item.daddr, "시설용량(m³/일)": item.fctCpc, "청천시유입하수량(m³/일)": item.chungchunFlow, diff --git a/apps/wr/app/(with-layout)/matMng/coMng/drgtSttn/page.tsx b/apps/wr/app/(with-layout)/matMng/coMng/drgtSttn/page.tsx index c27d418e6..b34a1eeba 100644 --- a/apps/wr/app/(with-layout)/matMng/coMng/drgtSttn/page.tsx +++ b/apps/wr/app/(with-layout)/matMng/coMng/drgtSttn/page.tsx @@ -68,6 +68,15 @@ export default function DrgtSttn() { sggNm: code.sggCd.find(sgg => sgg.text == item.sggNm)?.text } }) + .sort((a, b) => { + // ctpvCd 기준 1차 정렬 + const ctpvCompare = (a.ctpvCd || '').localeCompare(b.ctpvCd || ''); + if (ctpvCompare !== 0) return ctpvCompare; + + // sggNm 기준 2차 정렬 + return (a.sggNm || '').localeCompare(b.sggNm || ''); + }); + const data = Array.isArray(resData) ? resData.map((item: customDrgt) => { return { From af6fd7b6c55a369603c6654e2ea998e576f4c2fa Mon Sep 17 00:00:00 2001 From: ljpark Date: Wed, 12 Nov 2025 16:01:29 +0900 Subject: [PATCH 4/4] =?UTF-8?q?wr:=20=ED=91=9C=EC=A4=80=EA=B3=B5=EC=82=AC?= =?UTF-8?q?=EB=B9=84=20=EC=98=81=EC=97=AD=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/(with-layout)/matMng/coMat/coMatRvw/page.tsx | 6 ++++++ .../components/ui/form/coMat/conCostForm/conCostForm.tsx | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/apps/wr/app/(with-layout)/matMng/coMat/coMatRvw/page.tsx b/apps/wr/app/(with-layout)/matMng/coMat/coMatRvw/page.tsx index d4e16b676..248f8f5e0 100644 --- a/apps/wr/app/(with-layout)/matMng/coMat/coMatRvw/page.tsx +++ b/apps/wr/app/(with-layout)/matMng/coMat/coMatRvw/page.tsx @@ -723,6 +723,12 @@ export default function CoMatRvw() { ))} + + + +
+

표준공사비 산정

+
-
+
-

+ {/*

표준공사비 산정 -

-
+ */} +

처리시설 표준공사비 산정