From a6f39491ef6e0c91ab4b4cbb35d5db140b22c565 Mon Sep 17 00:00:00 2001 From: jsyang Date: Tue, 12 Aug 2025 11:36:38 +0900 Subject: [PATCH] =?UTF-8?q?rdii=20=EB=B6=84=EC=84=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/fo/app/store/facilityWaterQlty/index.tsx | 3 +- apps/fo/app/store/rdi/index.tsx | 39 ++++++++++++++++++- apps/fo/app/store/underWaterInput/index.tsx | 8 +++- 3 files changed, 47 insertions(+), 3 deletions(-) diff --git a/apps/fo/app/store/facilityWaterQlty/index.tsx b/apps/fo/app/store/facilityWaterQlty/index.tsx index 53e430d47..3c5cd9067 100644 --- a/apps/fo/app/store/facilityWaterQlty/index.tsx +++ b/apps/fo/app/store/facilityWaterQlty/index.tsx @@ -269,7 +269,7 @@ const fetchFacilityWaterQltyTmsList = async (facilityCd: string|undefined) => { }; // 시설정보 수질 리스트 데이터 호출(모달-이력) -const fetchFacilityWaterQltyListHist = async (searchYear: string|undefined, facilityCd: string|undefined): Promise => { +export const fetchFacilityWaterQltyListHist = async (searchYear: string|undefined, facilityCd: string|undefined): Promise => { try {// const res = await getFetch('fo', '/fclt/qlty/hist/' + searchYear + '/' + facilityCd); return res; @@ -623,6 +623,7 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType if(item.efflWqltTn){ item.efflWqltTn = Number(Math.round(Number(item.efflWqltTn) * 1000)/1000).toFixed(3); } + if(item.inflAssctBfrWqltTp){ item.inflAssctBfrWqltTp = Number(Math.round(Number(item.inflAssctBfrWqltTp) * 1000)/1000).toFixed(3); } diff --git a/apps/fo/app/store/rdi/index.tsx b/apps/fo/app/store/rdi/index.tsx index fd9ca52b6..398c51a52 100644 --- a/apps/fo/app/store/rdi/index.tsx +++ b/apps/fo/app/store/rdi/index.tsx @@ -1,6 +1,8 @@ +import { getFetch } from "@/app/components/api"; import DataForm from "@/app/components/common/DataForm"; import type { TableUpperProps } from "../dashboard"; -import { getFetch } from "@/app/components/api"; +import { fetchFacilityWaterQltyListHist } from "../facilityWaterQlty"; +import { calRainEffectDay } from "../underWaterInput"; export type { TableUpperProps }; /**==================================== * Store - 타입 @@ -27,6 +29,7 @@ export type RdiProps = { rvbsn : string, lgbsn : string, mdmbsn : string, + rainEffectDay : number, // 강우영향일 } export interface RdiInterface { @@ -242,6 +245,40 @@ export const rdiReducer:(set:SetStateFunction)=>RdiActions=(set: SetStateFunctio } }) + // 청천히 동절기 유입bod를 새로 구하기 위해서 재 호출 + for (const item of rtnData) { + const fcltyCd = item.bscFctCd; + let winterInflBod = 0; + + const res: any = await fetchFacilityWaterQltyListHist(searchYear, fcltyCd); + + if (res?.data) { + const rtnWqltData = res.data.wqltObjs; + rtnWqltData.forEach((dataItem: any) => { + dataItem.rainEffectDay = 0; + }); + + calRainEffectDay(rtnWqltData, 'SUNNY'); + + const rtnWqltWinterData = rtnWqltData.filter((dataItem: any) => + dataItem.msrDt.substring(4, 6) === '01' || + dataItem.msrDt.substring(4, 6) === '02' + ); + + rtnWqltWinterData.forEach((dataItem: any) => { + winterInflBod += dataItem.inflAssctBfrWqltBod + ? Number(dataItem.inflAssctBfrWqltBod) + : 0; + }); + + if (rtnWqltWinterData.length > 0) { + winterInflBod = winterInflBod / rtnWqltWinterData.length; + } + } + + item.winterAvgBodLowRainfall = winterInflBod; + } + rtnData.forEach((item: RdiProps) => { dataFormSetting(item) }) diff --git a/apps/fo/app/store/underWaterInput/index.tsx b/apps/fo/app/store/underWaterInput/index.tsx index 589c35962..db6fa34aa 100644 --- a/apps/fo/app/store/underWaterInput/index.tsx +++ b/apps/fo/app/store/underWaterInput/index.tsx @@ -261,7 +261,13 @@ const dataFormSetting=(item : UnderWaterProps)=> { export type UnderWaterStore = UnderWaterType & UnderWaterActions; -export const calRainEffectDay = (data: FlowDataItem[], weather: string) => { +/** + * + * @param data + * @param weather ('ALL' | 'SUNNY' | 'RAINY') + * @returns + */ +export const calRainEffectDay = (data: any, weather: string) => { // 강우영향일 계산 (강우량이 3 이상이면 무조건 강우영향일) for(let idx = 0; idx < data.length; idx++) { const item = data[idx];