From 03f87c20424660a871229b659aeb6d9e88386abc Mon Sep 17 00:00:00 2001 From: jsyang Date: Wed, 20 Aug 2025 10:53:30 +0900 Subject: [PATCH 01/35] =?UTF-8?q?=EA=B0=95=EC=9A=B0=EB=9F=89=20=ED=98=84?= =?UTF-8?q?=ED=99=A9=20=ED=8C=9D=EC=97=85=EC=88=98=EC=A0=95=EC=A7=84?= =?UTF-8?q?=ED=96=89=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/components/common/CalcRainEffect.tsx | 54 +++++++++++++++++++ .../facilityPrecipitation/modal/page.tsx | 24 +++++---- .../facilityPrecipitation/page.tsx | 8 --- .../processFacility/modal/page.tsx | 10 ++-- apps/fo/app/store/dashboard/index.tsx | 2 +- .../app/store/facilityPrecipitation/index.tsx | 25 ++------- apps/fo/app/store/rdi/index.tsx | 2 +- 7 files changed, 80 insertions(+), 45 deletions(-) create mode 100644 apps/fo/app/components/common/CalcRainEffect.tsx diff --git a/apps/fo/app/components/common/CalcRainEffect.tsx b/apps/fo/app/components/common/CalcRainEffect.tsx new file mode 100644 index 000000000..bc989b264 --- /dev/null +++ b/apps/fo/app/components/common/CalcRainEffect.tsx @@ -0,0 +1,54 @@ +/** + * 강우영향일 계산 로직 + * + * 1.강우영향일 및 강우량을 계산하며 강우량이 3이상이면 강우영향일이며 이후 이틀까지 강우영향일로 포함 + * + * 2.강우영향일이면서 3mm이하의 강우량일 경우에는 강우영향을 준 날의 강우량을 따름 + * @param data + * @author jsyang + */ + +export default function CalcRainEffect(data : any) { + console.log("%c Calculate RainEffect ! ", "background:blue;color:white"); + // 강우영향일 계산 (강우량이 3 초과이면 무조건 강우영향일) + for(let idx = 0; idx < data.length; idx++) { + const item = data[idx]; + if(item){ + if(item.infoRnDay && Number(item.infoRnDay) >= 3) { + item.rainEffectDay = 1; + } else { + item.rainEffectDay = 0; + } + } + } + + // 이틀 전, 하루 전이 강우영향일(3 이상)인 경우 해당 날도 강우영향일로 설정 + for(let idx = 0; idx < data.length; idx++) { + if(data[idx]) { + // 하루 전이 강우영향일(3 이상)인 경우 + if(idx > 0 && data[idx-1]?.infoRnDay && Number(data[idx-1]?.infoRnDay) >= 3) { + data[idx]!.rainEffectDay = 1; + } + // 이틀 전이 강우영향일(3 이상)인 경우 + if(idx > 1 && data[idx-2]?.infoRnDay && Number(data[idx-2]?.infoRnDay) >= 3) { + data[idx]!.rainEffectDay = 1; + } + } + } + + for(let idx = 0; idx < data.length; idx++) { + if(data[idx] && data[idx]?.rainEffectDay === 1) { + if(idx > 1){ + if(data[idx-1]?.infoRnDay && Number(data[idx]?.infoRnDay) < 3 && Number(data[idx-1]?.infoRnDay.toString().trim()) >= 3) { + data[idx]!.infoRnDay = data[idx-1]!.infoRnDay; + } + } + if(idx > 2){ + if(data[idx-2]?.infoRnDay && Number(data[idx]?.infoRnDay) < 3 && Number(data[idx-2]?.infoRnDay.toString().trim()) >= 3) { + data[idx]!.infoRnDay = data[idx-2]!.infoRnDay; + } + } + } + } + return data; +} \ No newline at end of file diff --git a/apps/fo/app/pages/(with-layout)/facilityPrecipitation/modal/page.tsx b/apps/fo/app/pages/(with-layout)/facilityPrecipitation/modal/page.tsx index 5a8e77dcd..904db73e2 100644 --- a/apps/fo/app/pages/(with-layout)/facilityPrecipitation/modal/page.tsx +++ b/apps/fo/app/pages/(with-layout)/facilityPrecipitation/modal/page.tsx @@ -1,4 +1,5 @@ "use client" +import CalcRainEffect from "@/app/components/common/CalcRainEffect"; import { useFoStore } from "@/app/store"; import type { PrecipitationPropsDetailProps } from "@/app/store/facilityPrecipitation"; import { DatePickerRange, UiTable } from "@common/business_components/ui"; @@ -29,6 +30,7 @@ export default function PrecipitationModal(props: PrecipitationModalProps) { // States const [startDate, setStartDate] = useState(null); const [endDate, setEndDate] = useState(null); + const didInit = useRef(false); const [filteredDetailList, setFilteredDetailList] = useState([]); const [copyDetailList, setCopyDetailList] = useState([]); @@ -113,17 +115,21 @@ export default function PrecipitationModal(props: PrecipitationModalProps) { }; useEffect(() => { + if(didInit.current) return; + if (props.detailList.length > 0) { - const filteredList = props.detailList.filter((item) => - props.facilityCd === item.bscFctCd - ); + didInit.current = true; + const filteredList = props.detailList + .map(i => ({ ...i })) // ← 얕은 복제 + .filter((item) => props.facilityCd === item.bscFctCd); + const calcData = CalcRainEffect(filteredList); + + setFilteredDetailList(calcData); + setCopyDetailList(calcData); - setFilteredDetailList(filteredList); - setCopyDetailList(filteredList); - - if (filteredList.length > 0) { - const firstDateStr = filteredList[0]?.rainDt; - const lastDateStr = filteredList[filteredList.length - 1]?.rainDt; + if (calcData.length > 0) { + const firstDateStr = calcData[0]?.rainDt; + const lastDateStr = calcData[filteredList.length - 1]?.rainDt; if (firstDateStr) { const firstDate = new Date(firstDateStr); diff --git a/apps/fo/app/pages/(with-layout)/facilityPrecipitation/page.tsx b/apps/fo/app/pages/(with-layout)/facilityPrecipitation/page.tsx index 8cd81ba51..c36386507 100644 --- a/apps/fo/app/pages/(with-layout)/facilityPrecipitation/page.tsx +++ b/apps/fo/app/pages/(with-layout)/facilityPrecipitation/page.tsx @@ -153,14 +153,6 @@ export default function FacilityPrecipitation() { */ // 조회 const searchFacilityPrecipitation = useCallback(({ partValue, regionValue, unitWaterShedValue, middleRegionValue, envPartValue, sidoValue, sigunValue }: ReturnType, pageNo: number, pageCnt:number=20) => { - console.log('partValue : ', partValue); - console.log('regionValue : ', regionValue); - console.log('unitWaterShedValue : ', unitWaterShedValue); - console.log('middleRegionValue : ', middleRegionValue); - console.log('envPartValue : ', envPartValue); - console.log('sidoValue : ', sidoValue); - console.log('sigunValue : ', sigunValue); - let nameCd, partStr switch (partValue) { case 'R': diff --git a/apps/fo/app/pages/(with-layout)/processFacility/modal/page.tsx b/apps/fo/app/pages/(with-layout)/processFacility/modal/page.tsx index 3afed1166..5764cb5ae 100644 --- a/apps/fo/app/pages/(with-layout)/processFacility/modal/page.tsx +++ b/apps/fo/app/pages/(with-layout)/processFacility/modal/page.tsx @@ -132,7 +132,7 @@ export default function ProcessFacilityInfoModal(props: ModalType) {
-
+
@@ -184,8 +184,8 @@ export default function ProcessFacilityInfoModal(props: ModalType) { -
-
+
+
{}}> {upHeadListFcltyHistInfoChange} @@ -193,8 +193,8 @@ export default function ProcessFacilityInfoModal(props: ModalType) {
-
-
+
+
{}}> {upHeadListFcltyWaterQltyInfoChange} diff --git a/apps/fo/app/store/dashboard/index.tsx b/apps/fo/app/store/dashboard/index.tsx index 8ad56e070..94d848ae9 100644 --- a/apps/fo/app/store/dashboard/index.tsx +++ b/apps/fo/app/store/dashboard/index.tsx @@ -1131,7 +1131,7 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) el.provisionalApproval = rtnPlanData?rtnPlanData.ugwtUseSum:''; } - if(index == 0 || index === 2){ + if(index === 2){ dataFormSettingPlan(el, 1); }else if(index == 4){ }else{ diff --git a/apps/fo/app/store/facilityPrecipitation/index.tsx b/apps/fo/app/store/facilityPrecipitation/index.tsx index 66727122d..47e9a1a1e 100644 --- a/apps/fo/app/store/facilityPrecipitation/index.tsx +++ b/apps/fo/app/store/facilityPrecipitation/index.tsx @@ -135,7 +135,6 @@ 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 : '') ; - console.log('tailStr', tailStr); const url = '/fclt/rain' + tailStr; const res = await getFetch('fo', url); const tmpData:PrecipitationPropsDetailProps[] = []; @@ -146,31 +145,13 @@ const fetchFacilityPrecipitationList = async (pageNo: number, pageSize: number, const rainDt = res.data[idx].rainyDayObjList[idx2].rainDt; const infoRnDay = res.data[idx].rainyDayObjList[idx2].infoRnDay; const rainDay = res.data[idx].rainyDayObjList[idx2].infoRnDay>=3?1:0; - let rainEffectDay = 0; - if(idx2 < res.data[idx].rainyDayObjList.length-2){ - if(rainDay==1){ - rainEffectDay = 1; - } else { - if(idx2 >= 2){ - if(res.data[idx].rainyDayObjList[idx2-1].infoRnDay>=3 || res.data[idx].rainyDayObjList[idx2-2].infoRnDay>=3){ - rainEffectDay = 1; - } - } - } - } else if(idx2 < res.data[idx].rainyDayObjList.length-1){ - if(rainDay==1 || res.data[idx].rainyDayObjList[idx2+1].infoRnDay>=3){ - rainEffectDay = 1; - } - } else { - rainEffectDay = rainDay; - } tmpData.push({ bscFctCd : bscFctCd, rainDt : rainDt, infoRnDay : infoRnDay, rainDay : rainDay, - rainEffectDay : rainEffectDay + rainEffectDay : rainDay }) } } @@ -183,8 +164,10 @@ const fetchFacilityPrecipitationList = async (pageNo: number, pageSize: number, item.rainEffectDay = filteredList.reduce((acc, curr) => acc + curr.rainEffectDay, 0); item.totalYearRain = filteredList.reduce((acc, curr) => acc + curr.infoRnDay, 0); item.infoRnDay = filteredList.reduce((acc, curr) => acc + curr.rainDay, 0); - }) + }); + } + 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 6fe400ce9..a739cd05e 100644 --- a/apps/fo/app/store/rdi/index.tsx +++ b/apps/fo/app/store/rdi/index.tsx @@ -209,7 +209,7 @@ const dataFormSetting=(item : RdiProps)=> { DataForm({ type: 'float0', column: 'fctCpc', item: item as unknown as Record }); DataForm({ type: 'float1', column: 'summerMinBodValue', item: item as unknown as Record}); DataForm({ type: 'float1', column: 'winterAvgBodLowRainfall', item: item as unknown as Record}); - DataForm({ type: 'float1', column: 'rdiiValue', item: item as unknown as Record}); + DataForm({ type: 'float0', column: 'rdiiValue', item: item as unknown as Record}); DataForm({ type: 'float1', column: 'infoRnDay', item: item as unknown as Record}); DataForm({ type: 'float0', column: 'inflAmnt', item: item as unknown as Record}); } From 4e7d291ad9103f0794e27c4b43f7086b9afdaa75 Mon Sep 17 00:00:00 2001 From: jsyang Date: Wed, 20 Aug 2025 11:15:47 +0900 Subject: [PATCH 02/35] =?UTF-8?q?=EA=B0=95=EC=9A=B0=EC=98=81=ED=96=A5?= =?UTF-8?q?=EC=9D=BC=20=EA=B3=B5=ED=86=B5=ED=99=94=20=EC=A7=84=ED=96=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../facilityPrecipitation/page.tsx | 2 +- .../(with-layout)/flowRate/modal/page.tsx | 3 +- apps/fo/app/store/dashboard/index.tsx | 52 +------------------ apps/fo/app/store/facilityWaterQlty/index.tsx | 46 ++-------------- apps/fo/app/store/flowRate/index.tsx | 43 +-------------- apps/fo/app/store/sewageOccur/index.tsx | 43 ++------------- 6 files changed, 12 insertions(+), 177 deletions(-) diff --git a/apps/fo/app/pages/(with-layout)/facilityPrecipitation/page.tsx b/apps/fo/app/pages/(with-layout)/facilityPrecipitation/page.tsx index c36386507..0d66de569 100644 --- a/apps/fo/app/pages/(with-layout)/facilityPrecipitation/page.tsx +++ b/apps/fo/app/pages/(with-layout)/facilityPrecipitation/page.tsx @@ -129,7 +129,7 @@ export default function FacilityPrecipitation() { initializeCommonData(); searchFacilityPrecipitationList(1, 10, selectSearchYear[0]?.val || "0"); } - }, [isInit, initializeCommonData, searchFacilityPrecipitationList]); + }, [isInit, initializeCommonData, searchFacilityPrecipitationList, selectSearchYear]); useEffect(() => { if (excelList && excelList.length > 0) { diff --git a/apps/fo/app/pages/(with-layout)/flowRate/modal/page.tsx b/apps/fo/app/pages/(with-layout)/flowRate/modal/page.tsx index 0685f93d6..87b398350 100644 --- a/apps/fo/app/pages/(with-layout)/flowRate/modal/page.tsx +++ b/apps/fo/app/pages/(with-layout)/flowRate/modal/page.tsx @@ -74,8 +74,7 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st let avgreturnAmnt = 0; let avgefflAmnt = 0; let avginfoRnDay = 0; - - console.log('filteredData', filteredData); + filteredData.forEach((item: FlowRateModalInterface) => { const totInflAmnt = parseNumber(item.totInflAmnt); const inflAmnt = parseNumber(item.inflAmnt); diff --git a/apps/fo/app/store/dashboard/index.tsx b/apps/fo/app/store/dashboard/index.tsx index 94d848ae9..38cd9db4e 100644 --- a/apps/fo/app/store/dashboard/index.tsx +++ b/apps/fo/app/store/dashboard/index.tsx @@ -7,6 +7,7 @@ import DataForm from "@/app/components/common/DataForm"; import { fetchPlanInfo, roundUp } from "../common"; import type { FacilityWaterQltyProps } from "../facilityWaterQlty"; import { calRainEffectDay, type ApiResponse, type FlowDataItem } from "../underWaterInput"; +import CalcRainEffect from "@/app/components/common/CalcRainEffect"; // selectBox export type SelectDataType = { @@ -999,55 +1000,6 @@ const searchWaterUsage = async (searchYear: string, fcltyCd: string) => { return waterUsage; } -// 강우영향일 계산 및 강우량 덮어씌우기 -export const calRainEffectDayRainManage = (data: RainManageListProps[]) => { - - // 강우영향일 계산 (강우량이 3 초과이면 무조건 강우영향일) - for(let idx = 0; idx < data.length; idx++) { - const item = data[idx]; - if(item){ - if(item.infoRnDay && Number(item.infoRnDay) >= 3) { - item.rainEffectDay = 1; - } else { - item.rainEffectDay = 0; - } - } - } - - // 이틀 전, 하루 전이 강우영향일(3 이상)인 경우 해당 날도 강우영향일로 설정 - for(let idx = 0; idx < data.length; idx++) { - if(data[idx]) { - // 하루 전이 강우영향일(3 이상)인 경우 - if(idx > 0 && data[idx-1]?.infoRnDay && Number(data[idx-1]?.infoRnDay) >= 3) { - data[idx]!.rainEffectDay = 1; - } - // 이틀 전이 강우영향일(3 이상)인 경우 - if(idx > 1 && data[idx-2]?.infoRnDay && Number(data[idx-2]?.infoRnDay) >= 3) { - data[idx]!.rainEffectDay = 1; - } - } - } - - for(let idx = 0; idx < data.length; idx++) { - if(data[idx] && data[idx]?.rainEffectDay === 1) { - if(idx > 1){ - if(data[idx-1]?.infoRnDay && Number(data[idx]?.infoRnDay) < 3 && Number(data[idx-1]?.infoRnDay) >= 3) { - data[idx]!.infoRnDay = data[idx-1]!.infoRnDay; - } - } - if(idx > 2){ - if(data[idx-2]?.infoRnDay && Number(data[idx]?.infoRnDay) < 3 && Number(data[idx-2]?.infoRnDay) >= 3) { - data[idx]!.infoRnDay = data[idx-2]!.infoRnDay; - } - } - } - } - - let rtnData : RainManageListProps[] = []; - rtnData = data.filter((item: RainManageListProps) => item.rainEffectDay === 1); - return rtnData; -} - export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) => void)=>DashBoardActions=(set: (fn: (state: DashBoardType) => DashBoardType) => void) => { return { initializeDashBoardData: async () => { @@ -1554,7 +1506,7 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) // 청천시 중 강우영향일인 날짜는 이전의 강우량을 대입해 리스트 수정 - const rainEffectList = calRainEffectDayRainManage(res.data.wqltObjs); + const rainEffectList = CalcRainEffect(res.data.wqltObjs); // Process the data and create rain management list const totItemCnt = rainEffectList?rainEffectList.length : 1; diff --git a/apps/fo/app/store/facilityWaterQlty/index.tsx b/apps/fo/app/store/facilityWaterQlty/index.tsx index 5b7bcf816..0eedb00a3 100644 --- a/apps/fo/app/store/facilityWaterQlty/index.tsx +++ b/apps/fo/app/store/facilityWaterQlty/index.tsx @@ -1,6 +1,7 @@ import { getFetch } from "@/app/components/api"; import DataForm from "@/app/components/common/DataForm"; import type { TableUpperProps } from "../dashboard"; +import CalcRainEffect from "@/app/components/common/CalcRainEffect"; export type { TableUpperProps }; /**==================================== @@ -208,7 +209,7 @@ const upHeadListModalYear: TableUpperProps[] = [ { id: "efflWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe2", upSequnce: 3, align: "right" }, { id: "efflWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe2", upSequnce: 2, align: "right" }, { id: "efflWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe2", upSequnce: 3, align: "right" }, - /* { id: "infoRnDay", title: "강우량(mm/일)", align: "right" }, */ + { id: "infoRnDay", title: "강우량\n(mm/일)", align: "right" } ]; // 처리시설 수질현황 헤더(모달-수질TMS) @@ -573,49 +574,8 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType } // facilityPrecipitation의 rainEffectDay 계산 로직을 적용 - - const data = res.data.wqltObjs; - // 강우영향일 계산 (강우량이 3 초과이면 무조건 강우영향일) - for(let idx = 0; idx < data.length; idx++) { - const item = data[idx]; - if(item){ - if(item.infoRnDay && Number(item.infoRnDay) > 3) { - item.rainEffectDay = 1; - } else { - item.rainEffectDay = 0; - } - } - } + const data = CalcRainEffect(res.data.wqltObjs); - // 이틀 전, 하루 전이 강우영향일(3 이상)인 경우 해당 날도 강우영향일로 설정 - for(let idx = 0; idx < data.length; idx++) { - if(data[idx]) { - // 하루 전이 강우영향일(3 이상)인 경우 - if(idx > 0 && data[idx-1]?.infoRnDay && Number(data[idx-1]?.infoRnDay) >= 3) { - data[idx]!.rainEffectDay = 1; - } - // 이틀 전이 강우영향일(3 이상)인 경우 - if(idx > 1 && data[idx-2]?.infoRnDay && Number(data[idx-2]?.infoRnDay) >= 3) { - data[idx]!.rainEffectDay = 1; - } - } - } - - for(let idx = 0; idx < data.length; idx++) { - if(data[idx] && data[idx]?.rainEffectDay === 1) { - if(idx > 1){ - if(data[idx-1]?.infoRnDay && Number(data[idx]?.infoRnDay) < 3 && Number(data[idx-1]?.infoRnDay) >= 3) { - data[idx]!.infoRnDay = data[idx-1]!.infoRnDay; - } - } - if(idx > 2){ - if(data[idx-2]?.infoRnDay && Number(data[idx]?.infoRnDay) < 3 && Number(data[idx-2]?.infoRnDay) >= 3) { - data[idx]!.infoRnDay = data[idx-2]!.infoRnDay; - } - } - } - } - const rtnData = data.map((item: FacilityWaterQltyProps) => { dataFormSetting(item) if(item.inflAssctBfrWqltTn) { diff --git a/apps/fo/app/store/flowRate/index.tsx b/apps/fo/app/store/flowRate/index.tsx index ec64465d0..011c08163 100644 --- a/apps/fo/app/store/flowRate/index.tsx +++ b/apps/fo/app/store/flowRate/index.tsx @@ -1,6 +1,7 @@ import { getFetch } from "@/app/components/api"; import type { TableUpperProps } from "../dashboard"; import DataForm from "@/app/components/common/DataForm"; +import CalcRainEffect from "@/app/components/common/CalcRainEffect"; /**==================================== * Store - 타입 @@ -318,47 +319,7 @@ export const flowRateSearchReducer:(set:(fn: (state: FlowRateSearchType) => Flow }, searchFlowRateModalList: async (bscFctCd: string, searchYear: string) => { const res = await fetchFlowRateModalList(bscFctCd, searchYear); - const data = res.data; - // 강우영향일 계산 (강우량이 3 초과이면 무조건 강우영향일) - for(let idx = 0; idx < data.length; idx++) { - const item = data[idx]; - if(item){ - if(item.infoRnDay && Number(item.infoRnDay.toString().trim()) >= 3) { - item.rainEffectDay = 1; - } else { - item.rainEffectDay = 0; - } - } - } - - // 이틀 전, 하루 전이 강우영향일(3 이상)인 경우 해당 날도 강우영향일로 설정 - for(let idx = 0; idx < data.length; idx++) { - if(data[idx]) { - // 하루 전이 강우영향일(3 이상)인 경우 - if(idx > 0 && data[idx-1]?.infoRnDay && Number(data[idx-1]?.infoRnDay.toString().trim()) >= 3) { - data[idx]!.rainEffectDay = 1; - } - // 이틀 전이 강우영향일(3 이상)인 경우 - if(idx > 1 && data[idx-2]?.infoRnDay && Number(data[idx-2]?.infoRnDay.toString().trim()) >= 3) { - data[idx]!.rainEffectDay = 1; - } - } - } - - for(let idx = 0; idx < data.length; idx++) { - if(data[idx] && data[idx]?.rainEffectDay === 1) { - if(idx > 1){ - if(data[idx-1]?.infoRnDay && Number(data[idx]?.infoRnDay) < 3 && Number(data[idx-1]?.infoRnDay.toString().trim()) >= 3) { - data[idx]!.infoRnDay = data[idx-1]!.infoRnDay; - } - } - if(idx > 2){ - if(data[idx-2]?.infoRnDay && Number(data[idx]?.infoRnDay) < 3 && Number(data[idx-2]?.infoRnDay.toString().trim()) >= 3) { - data[idx]!.infoRnDay = data[idx-2]!.infoRnDay; - } - } - } - } + const data = CalcRainEffect(res.data); const rtnData = data.map((item: FlowRateModalProps) => { item.totInflAmnt = Number(item.inflAmnt || 0) + Number(item.sumFlow || 0) + Number(item.returnAmnt || 0) diff --git a/apps/fo/app/store/sewageOccur/index.tsx b/apps/fo/app/store/sewageOccur/index.tsx index 4a6d055f0..5645c89bc 100644 --- a/apps/fo/app/store/sewageOccur/index.tsx +++ b/apps/fo/app/store/sewageOccur/index.tsx @@ -1,6 +1,7 @@ import DataForm from "@/app/components/common/DataForm"; import type { TableUpperProps } from "../dashboard"; import { getFetch } from "@/app/components/api"; +import CalcRainEffect from "@/app/components/common/CalcRainEffect"; export type { TableUpperProps }; /**==================================== * Store - 타입 @@ -236,47 +237,9 @@ export const sewageOccurReducer:(set:any)=>SewageOccurActions=(set: any) => { let totWaterUsage = 0; // 강우영향일 계산 (강우량이 3 초과이면 무조건 강우영향일) - for(let idx = 0; idx < res2.data.length; idx++) { - const item = res2.data[idx]; - if(item){ - if(item.infoRnDay && Number(item.infoRnDay.toString().trim()) >= 3) { - item.rainEffectDay = 1; - } else { - item.rainEffectDay = 0; - } - } - } - - // 이틀 전, 하루 전이 강우영향일(3 이상)인 경우 해당 날도 강우영향일로 설정 - for(let idx = 0; idx < res2.data.length; idx++) { - if(res2.data[idx]) { - // 하루 전이 강우영향일(3 이상)인 경우 - if(idx > 0 && res2.data[idx-1]?.infoRnDay && Number(res2.data[idx-1]?.infoRnDay.toString().trim()) >= 3) { - res2.data[idx]!.rainEffectDay = 1; - } - // 이틀 전이 강우영향일(3 이상)인 경우 - if(idx > 1 && res2.data[idx-2]?.infoRnDay && Number(res2.data[idx-2]?.infoRnDay.toString().trim()) >= 3) { - res2.data[idx]!.rainEffectDay = 1; - } - } - } - - for(let idx = 0; idx < res2.data.length; idx++) { - if(res2.data[idx] && res2.data[idx]?.rainEffectDay === 1) { - if(idx > 1){ - if(res2.data[idx-1]?.infoRnDay && Number(res2.data[idx]?.infoRnDay) < 3 && Number(res2.data[idx-1]?.infoRnDay.toString().trim()) >= 3) { - res2.data[idx]!.infoRnDay = res2.data[idx-1]!.infoRnDay; - } - } - if(idx > 2){ - if(res2.data[idx-2]?.infoRnDay && Number(res2.data[idx]?.infoRnDay) < 3 && Number(res2.data[idx-2]?.infoRnDay.toString().trim()) >= 3) { - res2.data[idx]!.infoRnDay = res2.data[idx-2]!.infoRnDay; - } - } - } - } + const rainEffectData = CalcRainEffect(res2.data); - res2.data.forEach((item: FlowDataItem) => { + rainEffectData.forEach((item: FlowDataItem) => { if(Number(item.rainEffectDay) === 0){ chungcunSumFlow += Number(item.inflAmnt); From fda8750f1489dfadaa327eeb07f71486d520e124 Mon Sep 17 00:00:00 2001 From: jsyang Date: Wed, 20 Aug 2025 16:52:19 +0900 Subject: [PATCH 03/35] =?UTF-8?q?rdii=20=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/components/common/CalcRainEffect.tsx | 16 +++- apps/fo/app/store/rdi/index.tsx | 63 +++++++++++++-- apps/fo/app/store/underWaterInput/index.tsx | 76 ++++--------------- apps/fo/app/store/underWaterInput/types.tsx | 6 ++ 4 files changed, 87 insertions(+), 74 deletions(-) diff --git a/apps/fo/app/components/common/CalcRainEffect.tsx b/apps/fo/app/components/common/CalcRainEffect.tsx index bc989b264..1ed7abaf3 100644 --- a/apps/fo/app/components/common/CalcRainEffect.tsx +++ b/apps/fo/app/components/common/CalcRainEffect.tsx @@ -4,11 +4,12 @@ * 1.강우영향일 및 강우량을 계산하며 강우량이 3이상이면 강우영향일이며 이후 이틀까지 강우영향일로 포함 * * 2.강우영향일이면서 3mm이하의 강우량일 경우에는 강우영향을 준 날의 강우량을 따름 - * @param data + * @param data + * @param weather (default:ALL) * @author jsyang */ -export default function CalcRainEffect(data : any) { +export default function CalcRainEffect(data : any, weather? : string | 'ALL') { console.log("%c Calculate RainEffect ! ", "background:blue;color:white"); // 강우영향일 계산 (강우량이 3 초과이면 무조건 강우영향일) for(let idx = 0; idx < data.length; idx++) { @@ -50,5 +51,14 @@ export default function CalcRainEffect(data : any) { } } } - return data; + + let rtnData : any = []; + if (weather === 'ALL') { + rtnData = data; + } else if (weather === 'SUNNY') { + rtnData = data.filter((item: any) => item.rainEffectDay === 0); + } else { + rtnData = data.filter((item: any) => item.rainEffectDay === 1); + } + return rtnData; } \ No newline at end of file diff --git a/apps/fo/app/store/rdi/index.tsx b/apps/fo/app/store/rdi/index.tsx index a739cd05e..8160ade2e 100644 --- a/apps/fo/app/store/rdi/index.tsx +++ b/apps/fo/app/store/rdi/index.tsx @@ -1,8 +1,9 @@ import { getFetch } from "@/app/components/api"; +import CalcRainEffect from "@/app/components/common/CalcRainEffect"; import DataForm from "@/app/components/common/DataForm"; import type { TableUpperProps } from "../dashboard"; import { fetchFacilityWaterQltyListHist } from "../facilityWaterQlty"; -import { calRainEffectDay } from "../underWaterInput"; +import type { FlowResponse } from "../sewageOccur"; export type { TableUpperProps }; /**==================================== * Store - 타입 @@ -30,6 +31,9 @@ export type RdiProps = { lgbsn : string, mdmbsn : string, rainEffectDay : number, // 강우영향일 + chungchunFlow : string | number | '', + rainCalInflAmnt : string | number | '', + properYn : string, } export interface RdiInterface { @@ -49,6 +53,10 @@ export interface RdiInterface { rvbsn : string, lgbsn : string, mdmbsn : string, + rainEffectDay : number, // 강우영향일 + chungchunFlow : string | number | '', + rainCalInflAmnt : string | number | '', + properYn : string, } // 모달 @@ -80,11 +88,14 @@ export interface ExcelType { 시설명: string, 주소: string, 시설용량: number, + 청천시유입하수량: string | number | '', 하절기강우일최저유입BOD: number | '', 하절기최저유입BOD유입유량: number | string | '', 동절기청천시유입BOD: number | '', RDII추정 : number | '', RDII추정시일강수량 : number | '', + 강우시총추정유입량 : string | number | '', + 적정여부 : string, } // 리스트 헤더 @@ -95,6 +106,7 @@ const upHeadList1:TableUpperProps[] = [ { id: "bscFctNm", title: "시설명", row:0, rowSpan:2 }, { id: "daddr", title: "주소", row:0, rowSpan:2 }, { id: "fctCpc", title: "시설용량\n(m³/일)", align:"right", row:0, rowSpan:2 }, + { id: "chungchunFlow", title: "청천시 유입하수량\n(m³/일)", align:"right", row:0, rowSpan:2 }, { id: "B", title: "하절기 운영현황(6~8월)", row:0, colSpan:2 }, { id: "summerMinBodValue", title: "3mm 이상 강우일 중 최저 유입BOD\n(mg/L)", align:"right", row:1 }, { id: "inflAmnt", title: "하절기최저유입BOD유입유량\n(m³/일)", row:1, align:"right" }, @@ -102,6 +114,8 @@ const upHeadList1:TableUpperProps[] = [ { id: "winterAvgBodLowRainfall", title: "청천시 유입BOD\n(mg/L)", row:1, align:"right" }, { id: "rdiiValue", title: "RDII추정", row:0, rowSpan:2, align:"right" }, { id: "infoRnDay", title: "RDII추정시일강수량\n(mm)", row:0, rowSpan:2, align:"right" }, + { id: "rainCalInflAmnt", title: "강우시 총 추정유입량\n(m³/일)", row:0, rowSpan:2, align:"right" }, + { id: "properYn", title: "적정여부", row:0, rowSpan:2 }, ]; const upHeadList2:TableUpperProps[] = [ @@ -112,6 +126,7 @@ const upHeadList2:TableUpperProps[] = [ { id: "bscFctNm", title: "시설명", row:0, rowSpan:2 }, { id: "daddr", title: "주소", row:0, rowSpan:2 }, { id: "fctCpc", title: "시설용량(m³/일)", align:"right", row:0, rowSpan:2 }, + { id: "chungchunFlow", title: "청천시 유입하수량\n(m³/일)", align:"right", row:0, rowSpan:2 }, { id: "B", title: "하절기 운영현황(6~8월)", row:0, colSpan:2 }, { id: "summerMinBodValue", title: "하절기강우일최저유입BOD", align:"right", row:1 }, { id: "inflAmnt", title: "하절기최저유입BOD유입유량", row:1, align:"right" }, @@ -119,6 +134,8 @@ const upHeadList2:TableUpperProps[] = [ { id: "winterAvgBodLowRainfall", title: "동절기청천시유입BOD", row:1, align:"right" }, { id: "rdiiValue", title: "RDII추정", row:0, rowSpan:2, align:"right" }, { id: "infoRnDay", title: "RDII추정시일강수량", row:0, rowSpan:2, align:"right" }, + { id: "rainCalInflAmnt", title: "강우시 총 추정유입량\n(m³/일)", row:0, rowSpan:2, align:"right" }, + { id: "properYn", title: "적정여부", row:0, rowSpan:2 }, ]; const upHeadList3:TableUpperProps[] = [ @@ -133,6 +150,7 @@ const upHeadList3:TableUpperProps[] = [ { id: "bscFctNm", title: "시설명", row:0, rowSpan:2 }, { id: "daddr", title: "주소", row:0, rowSpan:2 }, { id: "fctCpc", title: "시설용량(m³/일)", align:"right", row:0, rowSpan:2 }, + { id: "chungchunFlow", title: "청천시 유입하수량\n(m³/일)", align:"right", row:0, rowSpan:2 }, { id: "C", title: "하절기 운영현황(6~8월)", row:0, colSpan:2 }, { id: "summerMinBodValue", title: "하절기강우일최저유입BOD", align:"right", row:1 }, { id: "inflAmnt", title: "하절기최저유입BOD유입유량", row:1, align:"right" }, @@ -140,6 +158,8 @@ const upHeadList3:TableUpperProps[] = [ { id: "winterAvgBodLowRainfall", title: "동절기청천시유입BOD", row:1, align:"right" }, { id: "rdiiValue", title: "RDII추정", row:0, rowSpan:2, align:"right" }, { id: "infoRnDay", title: "RDII추정시일강수량", row:0, rowSpan:2, align:"right" }, + { id: "rainCalInflAmnt", title: "강우시 총 추정유입량\n(m³/일)", row:0, rowSpan:2, align:"right" }, + { id: "properYn", title: "적정여부", row:0, rowSpan:2 }, ]; const rdiList:RdiProps[] = [ @@ -153,7 +173,6 @@ const fetchRdiList = async (pageNo: number, pageSize: number, searchYear: string try{ const tailStr = partCd ? '/'+ partCd + '/' + nameCd + '/' + fcltCpct + '/' + operationValue + (fcltyNm && fcltyNm !== '' ? '/' + fcltyNm : '') : ''; const url = '/rdii/list/' + pageNo + '/' + pageSize + '/' + searchYear + tailStr; - console.log(url); const res = await getFetch('fo', url); return { data: res.data, count: res.count } }catch(error){ @@ -212,6 +231,8 @@ const dataFormSetting=(item : RdiProps)=> { DataForm({ type: 'float0', column: 'rdiiValue', item: item as unknown as Record}); DataForm({ type: 'float1', column: 'infoRnDay', item: item as unknown as Record}); DataForm({ type: 'float0', column: 'inflAmnt', item: item as unknown as Record}); + DataForm({ type: 'float0', column: 'chungchunFlow', item: item as unknown as Record}); + DataForm({ type: 'float0', column: 'rainCalInflAmnt', item: item as unknown as Record}); } // Add type definitions for state setter function @@ -232,9 +253,32 @@ export const rdiReducer:(set:SetStateFunction)=>RdiActions=(set: SetStateFunctio const res = await fetchRdiList(pageNo, pageSize, searchYear, partCd, nameCd, fcltCpct, operationValue, fcltyNm); const data = res.data; - const excelDownList: ExcelType[] = []; + const reData = await Promise.all(data.map(async (item: RdiProps) => { + const bscFctCd = item.bscFctCd; + const res2 = await getFetch('fo', '/fclt/flow/' + bscFctCd + '/' + searchYear) as FlowResponse; + const calData = CalcRainEffect(res2.data, 'SUNNY'); + let avgChungcunSumFlow = 0; + let chungcunSumFlow = 0; - const rtnData = data.map((item: RdiProps) => { + calData.forEach((flowItem: any) => { + chungcunSumFlow += flowItem.inflAmnt && flowItem.inflAmnt !== 'x' ? Number(flowItem.inflAmnt.toString().trim()) : 0; + /* if(flowItem.msrDt.substring(4,6) ==='06' || flowItem.msrDt.substring(4,6) ==='07' || flowItem.msrDt.substring(4,6) ==='08'){ + sumSummerChungcunDay += 1; + sumSummerChungcunFlow += flowItem.inflAmnt && flowItem.inflAmnt !== 'x' ? Number(flowItem.inflAmnt.toString().trim()) : 0; + }else if(flowItem.msrDt.substring(4,6) ==='01' || flowItem.msrDt.substring(4,6) ==='02'){ + sumWinterChungcunDay += 1; + sumWinterChungcunFlow += flowItem.inflAmnt && flowItem.inflAmnt !== 'x' ? Number(flowItem.inflAmnt.toString().trim()) : 0; + } */ + }); + avgChungcunSumFlow = chungcunSumFlow&&chungcunSumFlow>0?chungcunSumFlow / calData.length : 0; + item.chungchunFlow = avgChungcunSumFlow; + item.rainCalInflAmnt = Number(avgChungcunSumFlow) - Number(item.rdiiValue); + item.properYn = Number(item.rainCalInflAmnt) > Number(item.fctCpc) ? '초과유입' : '적정' + return item; + })); + + const excelDownList: ExcelType[] = []; + const rtnData = reData.map((item: RdiProps) => { return { ...item, sido: item.lclgvrnmntNm.split(' ')[0]?.toString() || '', @@ -256,9 +300,9 @@ export const rdiReducer:(set:SetStateFunction)=>RdiActions=(set: SetStateFunctio dataItem.rainEffectDay = 0; }); - calRainEffectDay(rtnWqltData, 'SUNNY'); + const calcData = CalcRainEffect(rtnWqltData, 'SUNNY'); - const rtnWqltWinterData = rtnWqltData.filter((dataItem: any) => + const rtnWqltWinterData = calcData.filter((dataItem: any) => (dataItem.msrDt.substring(4, 6) === '01' || dataItem.msrDt.substring(4, 6) === '02') && dataItem.rainEffectDay == 0 @@ -295,11 +339,14 @@ export const rdiReducer:(set:SetStateFunction)=>RdiActions=(set: SetStateFunctio 시군구: item.sigungo, 주소: item.daddr, 시설용량: item.fctCpc, + 청천시유입하수량: item.chungchunFlow, 하절기강우일최저유입BOD: item.summerMinBodValue, 하절기최저유입BOD유입유량: item.inflAmnt, 동절기청천시유입BOD: item.winterAvgBodLowRainfall, - RDII추정 : item.rdiiValue, - RDII추정시일강수량 : item.infoRnDay, + RDII추정: item.rdiiValue, + RDII추정시일강수량: item.infoRnDay, + 강우시총추정유입량: item.rainCalInflAmnt, + 적정여부: item.properYn, }); }); } diff --git a/apps/fo/app/store/underWaterInput/index.tsx b/apps/fo/app/store/underWaterInput/index.tsx index e9c664b99..fb064deef 100644 --- a/apps/fo/app/store/underWaterInput/index.tsx +++ b/apps/fo/app/store/underWaterInput/index.tsx @@ -2,6 +2,7 @@ import { getFetch } from "@/app/components/api"; import DataForm from "@/app/components/common/DataForm"; import type { TableUpperProps } from "../dashboard"; import type { ExcelType, UnderWaterInputModalProps, UnderWaterProps } from "./types"; +import CalcRainEffect from "@/app/components/common/CalcRainEffect"; export type { TableUpperProps }; // SewageOccurDetailProps 타입을 여기에 정의 @@ -38,10 +39,12 @@ const upHeadList1:TableUpperProps[] = [ { id: "bscFctNm", title: "시설명", row:0, rowSpan:2 }, { id: "daddr", title: "주소", row:0, rowSpan:2 }, { id: "fctCpc", title: "시설용량(m³/일)", align:"right", row:0, rowSpan:2 }, + { id: "inflAmnt", title: "평균유입하수량(m³/일)", align:"right", row:0, rowSpan:2 }, { id: "C", title: "지하수 유입량 추정", align:"right", row:0, colSpan:3 }, { id: "underWaterInputYear", title: "연간\n(m³/일)", align:"right", row:1 }, { id: "underWaterInputSummer", title: "하절기\n(m³/일)", align:"right", row:1 }, { id: "underWaterInputWinter", title: "동절기\n(m³/일)", align:"right", row:1 }, + { id: "properYn", title: "적정여부", row:0, rowSpan:2 }, ]; const upHeadList2:TableUpperProps[] = [ @@ -52,10 +55,12 @@ const upHeadList2:TableUpperProps[] = [ { id: "bscFctNm", title: "시설명", row:0, rowSpan:2 }, { id: "daddr", title: "주소", row:0, rowSpan:2 }, { id: "fctCpc", title: "시설용량(m³/일)", align:"right", row:0, rowSpan:2 }, + { id: "inflAmnt", title: "평균유입하수량(m³/일)", align:"right", row:0, rowSpan:2 }, { id: "C", title: "지하수 유입량 추정", align:"right", row:0, colSpan:3 }, { id: "underWaterInputYear", title: "연간\n(m³/일)", align:"right", row:1 }, { id: "underWaterInputSummer", title: "하절기\n(m³/일)", align:"right", row:1 }, { id: "underWaterInputWinter", title: "동절기\n(m³/일)", align:"right", row:1 }, + { id: "properYn", title: "적정여부", row:0, rowSpan:2 }, ]; const upHeadList3:TableUpperProps[] = [ @@ -70,10 +75,12 @@ const upHeadList3:TableUpperProps[] = [ { id: "bscFctNm", title: "시설명", row:0, rowSpan:2 }, { id: "daddr", title: "주소", row:0, rowSpan:2 }, { id: "fctCpc", title: "시설용량(m³/일)", align:"right", row:0, rowSpan:2 }, + { id: "inflAmnt", title: "평균유입하수량(m³/일)", align:"right", row:0, rowSpan:2 }, { id: "C", title: "지하수 유입량 추정", align:"right", row:0, colSpan:3 }, { id: "underWaterInputYear", title: "연간\n(m³/일)", align:"right", row:1 }, { id: "underWaterInputSummer", title: "하절기\n(m³/일)", align:"right", row:1 }, { id: "underWaterInputWinter", title: "동절기\n(m³/일)", align:"right", row:1 }, + { id: "properYn", title: "적정여부", row:0, rowSpan:2 }, ]; // 모달 @@ -251,6 +258,7 @@ export const underWaterInitState: UnderWaterType = { const dataFormSetting=(item : UnderWaterProps)=> { DataForm({ type: 'float0', column: 'fctCpc', item: item as unknown as Record }); + DataForm({ type: 'float0', column: 'inflAmnt', item: item as unknown as Record }); DataForm({ type: 'float0', column: 'underWaterInputYear', item: item as unknown as Record}); DataForm({ type: 'float0', column: 'underWaterInputSummer', item: item as unknown as Record}); DataForm({ type: 'float0', column: 'underWaterInputWinter', item: item as unknown as Record}); @@ -258,65 +266,6 @@ const dataFormSetting=(item : UnderWaterProps)=> { export type UnderWaterStore = UnderWaterType & UnderWaterActions; -/** - * - * @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]; - if(item){ - if(item.infoRnDay && Number(item.infoRnDay.toString().trim()) >= 3) { - item.rainEffectDay = 1; - } else { - item.rainEffectDay = 0; - } - } - } - - // 이틀 전, 하루 전이 강우영향일(3 이상)인 경우 해당 날도 강우영향일로 설정 - for(let idx = 0; idx < data.length; idx++) { - if(data[idx]) { - // 하루 전이 강우영향일(3 이상)인 경우 - if(idx > 0 && data[idx-1]?.infoRnDay && Number(data[idx-1]?.infoRnDay.toString().trim()) >= 3) { - data[idx]!.rainEffectDay = 1; - } - // 이틀 전이 강우영향일(3 이상)인 경우 - if(idx > 1 && data[idx-2]?.infoRnDay && Number(data[idx-2]?.infoRnDay.toString().trim()) >= 3) { - data[idx]!.rainEffectDay = 1; - } - } - } - - for(let idx = 0; idx < data.length; idx++) { - if(data[idx] && data[idx]?.rainEffectDay === 1) { - if(idx > 1){ - if(data[idx-1]?.infoRnDay && Number(data[idx]?.infoRnDay) < 3 && Number(data[idx-1]?.infoRnDay.toString().trim()) >= 3) { - data[idx]!.infoRnDay = data[idx-1]!.infoRnDay; - } - } - if(idx > 2){ - if(data[idx-2]?.infoRnDay && Number(data[idx]?.infoRnDay) < 3 && Number(data[idx-2]?.infoRnDay.toString().trim()) >= 3) { - data[idx]!.infoRnDay = data[idx-2]!.infoRnDay; - } - } - } - } - - let rtnData : FlowDataItem[] = []; - if (weather === 'ALL') { - rtnData = data; - } else if (weather === 'SUNNY') { - rtnData = data.filter((item: FlowDataItem) => item.rainEffectDay === 0); - } else { - rtnData = data.filter((item: FlowDataItem) => item.rainEffectDay === 1); - } - return rtnData; -} - export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterType) => void)=>UnderWaterActions=(set: (fn: (state: UnderWaterType) => UnderWaterType) => void) => { return { searchUnderWaterList: async (pageNo: number, pageSize: number, searchYear: string, part?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => { @@ -337,7 +286,7 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy const bscFctCd = item.bscFctCd; const res2 = await getFetch('fo', '/fclt/flow/' + bscFctCd + '/' + searchYear) as ApiResponse; - const calData = calRainEffectDay(res2.data, 'SUNNY'); + const calData = CalcRainEffect(res2.data, 'SUNNY'); let chungcunSumFlow = 0; let sumSummerChungcunDay = 0; @@ -370,7 +319,7 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy item.underWaterInputYear = Math.round((usage-(usage*0.65*0.9)) * 1) / 1; item.underWaterInputSummer = Math.round((summerUsage-(summerUsage*0.65*0.9)) * 1) / 1; item.underWaterInputWinter = Math.round((winterUsage-(winterUsage*0.65*0.9)) * 1) / 1; - + item.properYn = Math.round( (Number(usage-(usage*0.65*0.9)) / Number(item.inflAmnt)) * 100 * 1 ) / 1 > 20?'초과유입':'적정'; return item; })); @@ -392,10 +341,11 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy 시설명: item.bscFctNm, 주소: item.daddr, 시설용량: item.fctCpc, + 평균유입하수량 :item.inflAmnt, 연간지하수유입량: item.underWaterInputYear, 하절기지하수유입량: item.underWaterInputSummer, 동절기지하수유입량: item.underWaterInputWinter, - + 적정여부: item.properYn, }); }); }else{ @@ -425,7 +375,7 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy const res = await getFetch('fo', '/fclt/flow/' + bscFctCd + '/' + searchYear); const monthData: SewageOccurDetailProps[] = []; - const calData = calRainEffectDay(res.data, 'SUNNY'); + const calData = CalcRainEffect(res.data, 'SUNNY'); let tot = 0; let cnt = 0; diff --git a/apps/fo/app/store/underWaterInput/types.tsx b/apps/fo/app/store/underWaterInput/types.tsx index c90c654ad..4e13e7c96 100644 --- a/apps/fo/app/store/underWaterInput/types.tsx +++ b/apps/fo/app/store/underWaterInput/types.tsx @@ -14,6 +14,8 @@ export type UnderWaterProps = { rvbsn : string, lgbsn : string, mdmbsn : string, + inflAmnt : number | '', + properYn : string | '', } export interface UnderWaterInterface { bscFctCd : string, @@ -30,6 +32,8 @@ export interface UnderWaterInterface { rvbsn : string, lgbsn : string, mdmbsn : string, + inflAmnt : number | '', + properYn : string | '', } // 모달 @@ -52,7 +56,9 @@ export interface ExcelType { 시설명: string, 주소: string, 시설용량: number, + 평균유입하수량 : number | '', 연간지하수유입량: number | '', 하절기지하수유입량: number | '', 동절기지하수유입량: number | '', + 적정여부: string | '', } \ No newline at end of file From 035f2fd4c1d645ca66d8799b544589b739f28cd5 Mon Sep 17 00:00:00 2001 From: jsyang Date: Wed, 20 Aug 2025 16:58:21 +0900 Subject: [PATCH 04/35] =?UTF-8?q?rdii=20=EC=82=B0=EC=8B=9D=20=EB=B0=8F=20?= =?UTF-8?q?=EC=A3=BC=EC=84=9D=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/fo/app/pages/(with-layout)/rdi/page.tsx | 5 +++-- apps/fo/app/store/rdi/index.tsx | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/fo/app/pages/(with-layout)/rdi/page.tsx b/apps/fo/app/pages/(with-layout)/rdi/page.tsx index b9a785233..72b1f16a2 100644 --- a/apps/fo/app/pages/(with-layout)/rdi/page.tsx +++ b/apps/fo/app/pages/(with-layout)/rdi/page.tsx @@ -107,7 +107,7 @@ export default function Rdi() { initializeCommonData(); searchRdiList(1, 10, selectSearchYear[0]?.val || "0"); } - }, [isInit, initializeCommonData, searchRdiList]); + }, [isInit, initializeCommonData, searchRdiList, selectSearchYear]); useEffect(() => { if (excelList && excelList.length > 0) { @@ -197,7 +197,8 @@ export default function Rdi() {
- ※주) 처리장 유입부에서 측정된 유량 및 수질조사 자료를 기준으로 산정된 결과임 + ※ 강우시 총 추정유입량 = 청천시 유입하수량 + RDII 추정값 + ※ 주) 처리장 유입부에서 측정된 유량 및 수질조사 자료를 기준으로 산정된 결과임
diff --git a/apps/fo/app/store/rdi/index.tsx b/apps/fo/app/store/rdi/index.tsx index 8160ade2e..310130bb0 100644 --- a/apps/fo/app/store/rdi/index.tsx +++ b/apps/fo/app/store/rdi/index.tsx @@ -272,8 +272,8 @@ export const rdiReducer:(set:SetStateFunction)=>RdiActions=(set: SetStateFunctio }); avgChungcunSumFlow = chungcunSumFlow&&chungcunSumFlow>0?chungcunSumFlow / calData.length : 0; item.chungchunFlow = avgChungcunSumFlow; - item.rainCalInflAmnt = Number(avgChungcunSumFlow) - Number(item.rdiiValue); - item.properYn = Number(item.rainCalInflAmnt) > Number(item.fctCpc) ? '초과유입' : '적정' + item.rainCalInflAmnt = Number(avgChungcunSumFlow) + Number(item.rdiiValue); + item.properYn = Number(item.rainCalInflAmnt) > Number(item.fctCpc) ? '초과유입' : '적정'; return item; })); From 1fa1a880e9bda8c3757d5cb59f0bf7be1d23a281 Mon Sep 17 00:00:00 2001 From: jsyang Date: Wed, 20 Aug 2025 18:01:06 +0900 Subject: [PATCH 05/35] =?UTF-8?q?=EC=97=90=EB=9F=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/(with-layout)/dashboard/page.tsx | 42 +++++++++---------- .../(with-layout)/dashboardMain/page.tsx | 2 +- .../facilityPrecipitation/modal/page.tsx | 8 +--- apps/fo/app/store/dashboard/index.tsx | 6 +-- 4 files changed, 26 insertions(+), 32 deletions(-) diff --git a/apps/fo/app/pages/(with-layout)/dashboard/page.tsx b/apps/fo/app/pages/(with-layout)/dashboard/page.tsx index 0903c9229..167df2a7b 100644 --- a/apps/fo/app/pages/(with-layout)/dashboard/page.tsx +++ b/apps/fo/app/pages/(with-layout)/dashboard/page.tsx @@ -60,11 +60,11 @@ export default function DashBoard() { const [searchYear, setSearchYear] = useState(selectSearchYear[0]?.val || '0'); // 시설명 const [fcltyList, setFcltyList] = useState<{bscFctCd: string, bscFctNm: string, fcltyCpc: number | '', trtFrfNm: string | '', efflWqltStndrdNm: string | ''}>({ - bscFctCd: '26260PB001R', - bscFctNm: '수영', - fcltyCpc: 452000, - trtFrfNm: '표준활성슬러지법, MLE, MBR', - efflWqltStndrdNm: '500톤 이상(Ⅳ지역)' + bscFctCd: '11000SW001R', + bscFctNm: '난지', + fcltyCpc: 860000, + trtFrfNm: '표준활성슬러지법, MLE, A2O', + efflWqltStndrdNm: '500톤 이상(Ⅲ지역)' }); const [searchFcltyList, setSearchFcltyList] = useState<{bscFctCd: string, bscFctNm: string, fcltyCpc: number | '', trtFrfNm: string | '', efflWqltStndrdNm: string | ''}>({ @@ -79,11 +79,11 @@ export default function DashBoard() { if (!isInit) { initializeCommonData(); setSearchFcltyList({ - bscFctCd: '26260PB001R', - bscFctNm: '수영', - fcltyCpc: 452000, - trtFrfNm: '표준활성슬러지법, MLE, MBR', - efflWqltStndrdNm: '500톤 이상(Ⅳ지역)' + bscFctCd: '11000SW001R', + bscFctNm: '난지', + fcltyCpc: 860000, + trtFrfNm: '표준활성슬러지법, MLE, A2O', + efflWqltStndrdNm: '500톤 이상(Ⅲ지역)' }); } }, [isInit, initializeCommonData]); @@ -265,22 +265,22 @@ export default function DashBoard() { const initVal = () => { setFcltyList({ - bscFctCd: '26260PB001R', - bscFctNm: '수영', - fcltyCpc: 452000, - trtFrfNm: '표준활성슬러지법, MLE, MBR', - efflWqltStndrdNm: '500톤 이상(Ⅳ지역)' + bscFctCd: '11000SW001R', + bscFctNm: '난지', + fcltyCpc: 860000, + trtFrfNm: '표준활성슬러지법, MLE, A2O', + efflWqltStndrdNm: '500톤 이상(Ⅲ지역)' }); setSearchFcltyList({ - bscFctCd: '26260PB001R', - bscFctNm: '수영', - fcltyCpc: 452000, - trtFrfNm: '표준활성슬러지법, MLE, MBR', - efflWqltStndrdNm: '500톤 이상(Ⅳ지역)' + bscFctCd: '11000SW001R', + bscFctNm: '난지', + fcltyCpc: 860000, + trtFrfNm: '표준활성슬러지법, MLE, A2O', + efflWqltStndrdNm: '500톤 이상(Ⅲ지역)' }); setSearchYear(selectSearchYear[0]?.val || '0'); - searchFcltyList.bscFctNm = '수영'; + searchFcltyList.bscFctNm = '난지'; setSidoValue('0'); setSigunValue('0'); diff --git a/apps/fo/app/pages/(with-layout)/dashboardMain/page.tsx b/apps/fo/app/pages/(with-layout)/dashboardMain/page.tsx index 71372672a..12bf0763c 100644 --- a/apps/fo/app/pages/(with-layout)/dashboardMain/page.tsx +++ b/apps/fo/app/pages/(with-layout)/dashboardMain/page.tsx @@ -12,7 +12,7 @@ export default function DashBoardFclty({ onFacilityChange, sidoSigun, facilityNm } = Common; // 시설명 - const [bscFctNm, setFcltyName] = useState(facilityNm || '수영'); + const [bscFctNm, setFcltyName] = useState(facilityNm || '난지'); const [bscFctCd, setbscFctCd] = useState('11000SW001R'); const [fcltyCpc, setFcltyCpc] = useState(860000); const [trtFrfNm, setTrtFrfNm] = useState('표준활성슬러지법, MLE, A2O'); diff --git a/apps/fo/app/pages/(with-layout)/facilityPrecipitation/modal/page.tsx b/apps/fo/app/pages/(with-layout)/facilityPrecipitation/modal/page.tsx index 904db73e2..980be5865 100644 --- a/apps/fo/app/pages/(with-layout)/facilityPrecipitation/modal/page.tsx +++ b/apps/fo/app/pages/(with-layout)/facilityPrecipitation/modal/page.tsx @@ -126,10 +126,9 @@ export default function PrecipitationModal(props: PrecipitationModalProps) { setFilteredDetailList(calcData); setCopyDetailList(calcData); - if (calcData.length > 0) { const firstDateStr = calcData[0]?.rainDt; - const lastDateStr = calcData[filteredList.length - 1]?.rainDt; + const lastDateStr = calcData[calcData.length - 1]?.rainDt; if (firstDateStr) { const firstDate = new Date(firstDateStr); @@ -137,7 +136,6 @@ export default function PrecipitationModal(props: PrecipitationModalProps) { setStartDate(firstDate); } } - if (lastDateStr) { const lastDate = new Date(lastDateStr); if (!isNaN(lastDate.getTime())) { @@ -148,10 +146,6 @@ export default function PrecipitationModal(props: PrecipitationModalProps) { } }, [props.detailList, props.facilityCd]); - if (!startDate || !endDate) { - return
로딩 중...
; - } - return ( <> diff --git a/apps/fo/app/store/dashboard/index.tsx b/apps/fo/app/store/dashboard/index.tsx index 38cd9db4e..4440b1dca 100644 --- a/apps/fo/app/store/dashboard/index.tsx +++ b/apps/fo/app/store/dashboard/index.tsx @@ -6,7 +6,7 @@ import { getFetch } from "@/app/components/api"; import DataForm from "@/app/components/common/DataForm"; import { fetchPlanInfo, roundUp } from "../common"; import type { FacilityWaterQltyProps } from "../facilityWaterQlty"; -import { calRainEffectDay, type ApiResponse, type FlowDataItem } from "../underWaterInput"; +import { type ApiResponse, type FlowDataItem } from "../underWaterInput"; import CalcRainEffect from "@/app/components/common/CalcRainEffect"; // selectBox @@ -1214,8 +1214,8 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) } }); - const calData = calRainEffectDay(res2.data, 'SUNNY'); - const calRainDate = calRainEffectDay(res2.data, 'RAIN'); + const calData = CalcRainEffect(res2.data, 'SUNNY'); + const calRainDate = CalcRainEffect(res2.data, 'RAIN'); // 지하수유입량 - 청천시 기준 let chungcunSumFlow = 0; From cc4e3ea0cf0f08f3eee0d8e6786dab963cfe6af9 Mon Sep 17 00:00:00 2001 From: jsyang Date: Wed, 20 Aug 2025 18:11:59 +0900 Subject: [PATCH 06/35] =?UTF-8?q?=EB=B9=8C=EB=93=9C=20=EC=97=90=EB=9F=AC?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/(with-layout)/facilityPrecipitation/modal/page.tsx | 4 ++-- apps/fo/app/store/planSewage/index.tsx | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/fo/app/pages/(with-layout)/facilityPrecipitation/modal/page.tsx b/apps/fo/app/pages/(with-layout)/facilityPrecipitation/modal/page.tsx index 980be5865..0b4ef5830 100644 --- a/apps/fo/app/pages/(with-layout)/facilityPrecipitation/modal/page.tsx +++ b/apps/fo/app/pages/(with-layout)/facilityPrecipitation/modal/page.tsx @@ -28,8 +28,8 @@ export default function PrecipitationModal(props: PrecipitationModalProps) { const endPickerRef = useRef(null); // States - const [startDate, setStartDate] = useState(null); - const [endDate, setEndDate] = useState(null); + const [startDate, setStartDate] = useState(new Date()); + const [endDate, setEndDate] = useState(new Date()); const didInit = useRef(false); const [filteredDetailList, setFilteredDetailList] = useState([]); const [copyDetailList, setCopyDetailList] = useState([]); diff --git a/apps/fo/app/store/planSewage/index.tsx b/apps/fo/app/store/planSewage/index.tsx index 885949e3b..36e5feb9f 100644 --- a/apps/fo/app/store/planSewage/index.tsx +++ b/apps/fo/app/store/planSewage/index.tsx @@ -1,7 +1,8 @@ import DataForm from "@/app/components/common/DataForm"; import type { TableUpperProps } from "../dashboard"; import { getFetch } from "@/app/components/api"; -import { calRainEffectDay, type ApiResponse, type FlowDataItem } from "../underWaterInput"; +import { type ApiResponse, type FlowDataItem } from "../underWaterInput"; +import CalcRainEffect from "@/app/components/common/CalcRainEffect"; export type { TableUpperProps }; /**==================================== * Store - 타입 @@ -182,7 +183,7 @@ export const planSewageReducer:(set:(fn: (state: PlanSewageType) => PlanSewageTy const data = res.data const processedData = await Promise.all(data.map(async (item:PlanSewageProps) => { const res2 = await getFetch('fo', '/fclt/flow/' + item.bscFctCd + '/' + searchYear) as ApiResponse; - const calData = calRainEffectDay(res2.data, 'SUNNY'); + const calData = CalcRainEffect(res2.data, 'SUNNY'); let sumInflAmntSunny = 0; let avgInflAmntSunny = 0; From fc70b9c4bee6f6b00e265f0746a0485f22f99843 Mon Sep 17 00:00:00 2001 From: jsyang Date: Thu, 21 Aug 2025 09:32:05 +0900 Subject: [PATCH 07/35] =?UTF-8?q?CalcRainEffect=20=EC=88=98=EC=A0=95(weath?= =?UTF-8?q?er=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/components/common/CalcRainEffect.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/fo/app/components/common/CalcRainEffect.tsx b/apps/fo/app/components/common/CalcRainEffect.tsx index 1ed7abaf3..faa3a5a38 100644 --- a/apps/fo/app/components/common/CalcRainEffect.tsx +++ b/apps/fo/app/components/common/CalcRainEffect.tsx @@ -9,8 +9,9 @@ * @author jsyang */ -export default function CalcRainEffect(data : any, weather? : string | 'ALL') { - console.log("%c Calculate RainEffect ! ", "background:blue;color:white"); +export default function CalcRainEffect(data : any, weather='ALL') { + console.log("%c Calculate RainEffect !" , "background:blue;color:white"); + console.log("%c Data Length :"+data.length+" Weather : "+weather , "background:yellow;color:blue"); // 강우영향일 계산 (강우량이 3 초과이면 무조건 강우영향일) for(let idx = 0; idx < data.length; idx++) { const item = data[idx]; From f425a303e540f3e9e6a83263bb7ac9e88ef2f76b Mon Sep 17 00:00:00 2001 From: jsyang Date: Thu, 21 Aug 2025 11:00:02 +0900 Subject: [PATCH 08/35] =?UTF-8?q?-=20=ED=8E=98=EC=9D=B4=EC=A7=80=EC=97=90?= =?UTF-8?q?=20=EC=82=B0=EC=8B=9D=20=EC=B6=94=EA=B0=80=20-=20=EC=98=A4?= =?UTF-8?q?=ED=83=80=EC=88=98=EC=A0=95=20-=20CalcRainEffect=EC=97=90=20?= =?UTF-8?q?=EA=B0=95=EC=9A=B0=EB=9F=89=20x=EC=8B=9C=200.0=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=ED=91=9C=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/fo/app/components/common/CalcRainEffect.tsx | 4 ++++ apps/fo/app/pages/(with-layout)/rdi/page.tsx | 2 +- .../pages/(with-layout)/underWaterInput/page.tsx | 1 + apps/fo/app/store/flowRate/index.tsx | 2 +- apps/fo/app/store/underWaterInput/index.tsx | 13 ++++++++++--- 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/apps/fo/app/components/common/CalcRainEffect.tsx b/apps/fo/app/components/common/CalcRainEffect.tsx index faa3a5a38..7df07c71b 100644 --- a/apps/fo/app/components/common/CalcRainEffect.tsx +++ b/apps/fo/app/components/common/CalcRainEffect.tsx @@ -21,6 +21,10 @@ export default function CalcRainEffect(data : any, weather='ALL') { } else { item.rainEffectDay = 0; } + + if(item.infoRnDay == 'x'){ + item.infoRnDay = '0.0'; + } } } diff --git a/apps/fo/app/pages/(with-layout)/rdi/page.tsx b/apps/fo/app/pages/(with-layout)/rdi/page.tsx index 72b1f16a2..9f0fef1b3 100644 --- a/apps/fo/app/pages/(with-layout)/rdi/page.tsx +++ b/apps/fo/app/pages/(with-layout)/rdi/page.tsx @@ -197,7 +197,7 @@ export default function Rdi() {
- ※ 강우시 총 추정유입량 = 청천시 유입하수량 + RDII 추정값 + ※ 강우시 총 추정유입량 = 청천시 유입하수량 + RDII 추정값

※ 주) 처리장 유입부에서 측정된 유량 및 수질조사 자료를 기준으로 산정된 결과임
diff --git a/apps/fo/app/pages/(with-layout)/underWaterInput/page.tsx b/apps/fo/app/pages/(with-layout)/underWaterInput/page.tsx index e731fb7a3..458e2c656 100644 --- a/apps/fo/app/pages/(with-layout)/underWaterInput/page.tsx +++ b/apps/fo/app/pages/(with-layout)/underWaterInput/page.tsx @@ -223,6 +223,7 @@ export default function UnderWaterInput() { index !== undefined && cellClick(index)} headName={"지하수유입량 추정"} tableData={mainList} headlist={upheadList} pageSize={10} total={total} resetPageNo={resetPage} onPageChange={handlePageChange} />
+ ※연평균 유입하수량 = 연간 지하수유입량/연평균 유입하수량*100

※지하수 유입량 = 하수처리장 청천시 실제유입량 - (물사용량 × 오수전환율)
diff --git a/apps/fo/app/store/flowRate/index.tsx b/apps/fo/app/store/flowRate/index.tsx index 011c08163..35e67815f 100644 --- a/apps/fo/app/store/flowRate/index.tsx +++ b/apps/fo/app/store/flowRate/index.tsx @@ -320,7 +320,7 @@ export const flowRateSearchReducer:(set:(fn: (state: FlowRateSearchType) => Flow searchFlowRateModalList: async (bscFctCd: string, searchYear: string) => { const res = await fetchFlowRateModalList(bscFctCd, searchYear); const data = CalcRainEffect(res.data); - + const rtnData = data.map((item: FlowRateModalProps) => { item.totInflAmnt = Number(item.inflAmnt || 0) + Number(item.sumFlow || 0) + Number(item.returnAmnt || 0) dataFormSetting(item); diff --git a/apps/fo/app/store/underWaterInput/index.tsx b/apps/fo/app/store/underWaterInput/index.tsx index fb064deef..1587d6933 100644 --- a/apps/fo/app/store/underWaterInput/index.tsx +++ b/apps/fo/app/store/underWaterInput/index.tsx @@ -39,7 +39,7 @@ const upHeadList1:TableUpperProps[] = [ { id: "bscFctNm", title: "시설명", row:0, rowSpan:2 }, { id: "daddr", title: "주소", row:0, rowSpan:2 }, { id: "fctCpc", title: "시설용량(m³/일)", align:"right", row:0, rowSpan:2 }, - { id: "inflAmnt", title: "평균유입하수량(m³/일)", align:"right", row:0, rowSpan:2 }, + { id: "inflAmnt", title: "연 평균유입하수량(m³/일)", align:"right", row:0, rowSpan:2 }, { id: "C", title: "지하수 유입량 추정", align:"right", row:0, colSpan:3 }, { id: "underWaterInputYear", title: "연간\n(m³/일)", align:"right", row:1 }, { id: "underWaterInputSummer", title: "하절기\n(m³/일)", align:"right", row:1 }, @@ -55,7 +55,7 @@ const upHeadList2:TableUpperProps[] = [ { id: "bscFctNm", title: "시설명", row:0, rowSpan:2 }, { id: "daddr", title: "주소", row:0, rowSpan:2 }, { id: "fctCpc", title: "시설용량(m³/일)", align:"right", row:0, rowSpan:2 }, - { id: "inflAmnt", title: "평균유입하수량(m³/일)", align:"right", row:0, rowSpan:2 }, + { id: "inflAmnt", title: "연 평균유입하수량(m³/일)", align:"right", row:0, rowSpan:2 }, { id: "C", title: "지하수 유입량 추정", align:"right", row:0, colSpan:3 }, { id: "underWaterInputYear", title: "연간\n(m³/일)", align:"right", row:1 }, { id: "underWaterInputSummer", title: "하절기\n(m³/일)", align:"right", row:1 }, @@ -75,7 +75,7 @@ const upHeadList3:TableUpperProps[] = [ { id: "bscFctNm", title: "시설명", row:0, rowSpan:2 }, { id: "daddr", title: "주소", row:0, rowSpan:2 }, { id: "fctCpc", title: "시설용량(m³/일)", align:"right", row:0, rowSpan:2 }, - { id: "inflAmnt", title: "평균유입하수량(m³/일)", align:"right", row:0, rowSpan:2 }, + { id: "inflAmnt", title: "연 평균유입하수량(m³/일)", align:"right", row:0, rowSpan:2 }, { id: "C", title: "지하수 유입량 추정", align:"right", row:0, colSpan:3 }, { id: "underWaterInputYear", title: "연간\n(m³/일)", align:"right", row:1 }, { id: "underWaterInputSummer", title: "하절기\n(m³/일)", align:"right", row:1 }, @@ -418,6 +418,13 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy } }); + + if(monthData.length == 0){ + maxWaterUsage = 0; + avgWaterUsage = 0; + minWaterUsage = 0; + } + console.log('tot', tot, 'calData.length', calData.length); avgWaterUsage = tot/cnt; console.log(avgWaterUsage); From 7ca09a60d866ae81265ca98d7ec94dd1072909c5 Mon Sep 17 00:00:00 2001 From: jsyang Date: Thu, 21 Aug 2025 11:25:11 +0900 Subject: [PATCH 09/35] =?UTF-8?q?-CalcRainEffect=20=EA=B0=95=EC=9A=B0?= =?UTF-8?q?=EB=9F=89=20=EC=9E=90=EB=A6=BF=EC=88=98=20=EC=86=8C=EC=88=98?= =?UTF-8?q?=EC=A0=90=20=EC=B2=AB=EC=A7=B8=EC=9E=90=EB=A6=AC=20=ED=91=9C?= =?UTF-8?q?=EC=8B=9C=20-=20=EC=88=98=EC=A7=88=ED=98=84=ED=99=A9=20?= =?UTF-8?q?=EC=B5=9C=EB=8C=80=20=EC=B5=9C=EC=86=8C=20BOD,=20COD=20?= =?UTF-8?q?=EC=88=98=EC=B9=98=20=EC=9D=B4=EC=83=81=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/fo/app/components/common/CalcRainEffect.tsx | 2 ++ .../pages/(with-layout)/facilityWaterQlty/modal/page.tsx | 9 ++++----- .../app/pages/(with-layout)/facilityWaterQlty/page.tsx | 1 - apps/fo/app/store/facilityWaterQlty/index.tsx | 4 +++- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/apps/fo/app/components/common/CalcRainEffect.tsx b/apps/fo/app/components/common/CalcRainEffect.tsx index 7df07c71b..b31470850 100644 --- a/apps/fo/app/components/common/CalcRainEffect.tsx +++ b/apps/fo/app/components/common/CalcRainEffect.tsx @@ -24,6 +24,8 @@ export default function CalcRainEffect(data : any, weather='ALL') { if(item.infoRnDay == 'x'){ item.infoRnDay = '0.0'; + }else{ + item.infoRnDay = Number(item.infoRnDay).toFixed(1); } } } diff --git a/apps/fo/app/pages/(with-layout)/facilityWaterQlty/modal/page.tsx b/apps/fo/app/pages/(with-layout)/facilityWaterQlty/modal/page.tsx index 0362b1ec3..48a94aa89 100644 --- a/apps/fo/app/pages/(with-layout)/facilityWaterQlty/modal/page.tsx +++ b/apps/fo/app/pages/(with-layout)/facilityWaterQlty/modal/page.tsx @@ -117,7 +117,6 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe const efflWqltTp = parseNumber(item.efflWqltTp); const efflWqltToc = parseNumber(item.efflWqltToc); const efflWqltSs = parseNumber(item.efflWqltSs); - const inflAssctBfrWqltBod = parseNumber(item.inflAssctBfrWqltBod); const inflAssctBfrWqltTn = parseNumber(item.inflAssctBfrWqltTn); const inflAssctBfrWqltTp = parseNumber(item.inflAssctBfrWqltTp); @@ -225,14 +224,14 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe sggNm: "", addr: "", fctCpc: 0, - infoRnDay: 0, + infoRnDay: Math.round(maxInfoRnDay * 10) / 10?(Math.round(maxInfoRnDay * 10) / 10).toFixed(1):'0.0', tpInflWqltBod: Math.round(maxTpInflWqltBod * 10) / 10?(Math.round(maxTpInflWqltBod * 10) / 10).toFixed(1):'0.0', tpInflWqltTp: Math.round(maxTpInflWqltTp * 1000) / 1000?(Math.round(maxTpInflWqltTp * 1000) / 1000).toFixed(3):'0.000' }, { msrDt : '최소', - efflWqltBod : Math.round(minEfflWqltBod * 10) / 10?(Math.round(minEfflWqltBod?minEfflWqltBod:0 * 10) / 10).toFixed(1) : '0.0', - efflWqltToc : Math.round(minefflWqltToc * 10) / 10?(Math.round(minefflWqltToc?minefflWqltToc:0 * 10) / 10).toFixed(1) : '0.0', + efflWqltBod : Math.round(minEfflWqltBod * 10) / 10?(Math.round(minEfflWqltBod * 10) / 10).toFixed(1) : '0.0', + efflWqltToc : Math.round(minefflWqltToc * 10) / 10?(Math.round(minefflWqltToc * 10) / 10).toFixed(1) : '0.0', efflWqltSs : Math.round(minEfflWqltSs * 10) / 10?(Math.round(minEfflWqltSs * 10) / 10).toFixed(1) : '0.0', efflWqltTn : Math.round(minEfflWqltTn * 1000) / 1000?(Math.round(minEfflWqltTn * 1000) / 1000).toFixed(3) : '0.000', efflWqltTp : Math.round(minEfflWqltTp * 1000) / 1000?(Math.round(minEfflWqltTp * 1000) / 1000).toFixed(3) : '0.000', @@ -248,7 +247,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe sggNm: "", addr: "", fctCpc: 0, - infoRnDay: 0, + infoRnDay: Math.round(minInfoRnDay * 10) / 10?'0.0':(Math.round(minInfoRnDay * 10) / 10).toFixed(1), tpInflWqltBod: Math.round(minTpInflWqltBod * 10) / 10?'0.0':(Math.round(minTpInflWqltBod * 10) / 10).toFixed(1), tpInflWqltTp: Math.round(minTpInflWqltTp * 1000) / 1000?'0.000':(Math.round(minTpInflWqltTp * 1000) / 1000).toFixed(3) }, diff --git a/apps/fo/app/pages/(with-layout)/facilityWaterQlty/page.tsx b/apps/fo/app/pages/(with-layout)/facilityWaterQlty/page.tsx index 0e215f565..be4902bf0 100644 --- a/apps/fo/app/pages/(with-layout)/facilityWaterQlty/page.tsx +++ b/apps/fo/app/pages/(with-layout)/facilityWaterQlty/page.tsx @@ -163,7 +163,6 @@ export default function ProcessFacilitySearch() { }, [searchFcltyQltyList]); const total = facilityWaterQltyCount || 1; - console.log('total : ', total); return ( diff --git a/apps/fo/app/store/facilityWaterQlty/index.tsx b/apps/fo/app/store/facilityWaterQlty/index.tsx index 0eedb00a3..c63d3f284 100644 --- a/apps/fo/app/store/facilityWaterQlty/index.tsx +++ b/apps/fo/app/store/facilityWaterQlty/index.tsx @@ -43,7 +43,7 @@ export interface FacilityWaterQltyProps { mdmbsn:string|'', inflAmnt: number | '', lclgvrnmntNm: string, - infoRnDay: number | '', + infoRnDay: number | string | '', rainEffectDay: number | '', tpInflWqltTmprtr: number | '', tpInflWqltPh: string | '', @@ -376,6 +376,7 @@ export type FacilityWaterQltyActions = { */ const dataFormSetting = (item: FacilityWaterQltyProps) => { DataForm({ type: 'date', column: 'msrDt', item: item as unknown as Record<string, unknown> }); + DataForm({ type: 'float1', column: 'infoRnDay', item: item as unknown as Record<string, unknown> }); } export type FacilityWaterQltyStore = FacilityWaterQltyType & FacilityWaterQltyActions; @@ -625,6 +626,7 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType }else{ item.tpInflWqltTp = ''; } + return item; }) set((state: FacilityWaterQltyType) => ({ From 8013483d172df6d115c9d709636a59648a1fa1ef Mon Sep 17 00:00:00 2001 From: jsyang <mind-one003@mind-one.co.kr> Date: Thu, 21 Aug 2025 18:27:52 +0900 Subject: [PATCH 10/35] =?UTF-8?q?=EB=8C=80=EC=8B=9C=EB=B3=B4=EB=93=9C=20?= =?UTF-8?q?=EC=88=98=EC=B9=98=20=EB=A7=9E=EC=B6=94=EB=8A=94=20=EC=9E=91?= =?UTF-8?q?=EC=97=85=20=EC=A7=84=ED=96=89=EC=A4=91=20(=ED=98=84=EC=9E=AC?= =?UTF-8?q?=20=EC=9C=A0=EC=9E=85=EC=9C=A0=EB=9F=89=20=EB=B0=8F=20=EC=B4=9D?= =?UTF-8?q?=EC=9C=A0=EC=9E=85=EB=9F=89=20=EB=A7=9E=EC=B6=94=EB=8A=94=20?= =?UTF-8?q?=EC=9E=91=EC=97=85=EC=99=84=EB=A3=8C)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../(with-layout)/facilityWaterQlty/page.tsx | 2 +- apps/fo/app/store/dashboard/index.tsx | 98 ++++++++++++++----- 2 files changed, 76 insertions(+), 24 deletions(-) diff --git a/apps/fo/app/pages/(with-layout)/facilityWaterQlty/page.tsx b/apps/fo/app/pages/(with-layout)/facilityWaterQlty/page.tsx index be4902bf0..98f5ba57a 100644 --- a/apps/fo/app/pages/(with-layout)/facilityWaterQlty/page.tsx +++ b/apps/fo/app/pages/(with-layout)/facilityWaterQlty/page.tsx @@ -134,7 +134,7 @@ export default function ProcessFacilitySearch() { initializeCommonData(); searchFacilityWaterQltyList(1, 10, selectSearchYear[0]?.val || "0"); } - }, [isInit, initializeCommonData, searchFacilityWaterQltyList]); + }, [isInit, initializeCommonData, searchFacilityWaterQltyList, selectSearchYear]); useEffect(() => { if (excelList && excelList.length > 0) { diff --git a/apps/fo/app/store/dashboard/index.tsx b/apps/fo/app/store/dashboard/index.tsx index 4440b1dca..ea751542f 100644 --- a/apps/fo/app/store/dashboard/index.tsx +++ b/apps/fo/app/store/dashboard/index.tsx @@ -1090,7 +1090,6 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) dataFormSettingPlan(el, 0); } - set((state: DashBoardType) => ({ ...state, PlanFclty: { @@ -1130,9 +1129,21 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) // 유량 - 유입 if (operationalStatusList?.[0]) { // 연간 - const yearAvg = data.yearData===null?'':(data.yearData.AVG_INFL_AMNT?data.yearData.AVG_INFL_AMNT:0)+(data.yearData.AVG_SUM_FLOW?data.yearData.AVG_SUM_FLOW:0)+(data.yearData.AVG_RETURN_AMNT?data.yearData.AVG_RETURN_AMNT:0); - const yearMax = data.yearData===null?'':(data.yearData.MAX_INFL_AMNT?data.yearData.MAX_INFL_AMNT:0)+(data.yearData.MAX_SUM_FLOW?data.yearData.MAX_SUM_FLOW:0)+(data.yearData.MAX_RETURN_AMNT?data.yearData.MAX_RETURN_AMNT:0); - const yearMin = data.yearData===null?'':(data.yearData.MIN_INFL_AMNT?data.yearData.MIN_INFL_AMNT:0)+(data.yearData.MIN_SUM_FLOW?data.yearData.MIN_SUM_FLOW:0)+(data.yearData.MIN_RETURN_AMNT?data.yearData.MIN_RETURN_AMNT:0); + const yearAvg = data.yearData===null ? '' : ( + (data.yearData.AVG_INFL_AMNT?data.yearData.AVG_INFL_AMNT:0) + + (data.yearData.AVG_SUM_FLOW?data.yearData.AVG_SUM_FLOW:0) + + (data.yearData.AVG_RETURN_AMNT?data.yearData.AVG_RETURN_AMNT:0) + ); + const yearMax = data.yearData===null ? '' : ( + (data.yearData.MAX_INFL_AMNT?data.yearData.MAX_INFL_AMNT:0) + + (data.yearData.MAX_SUM_FLOW?data.yearData.MAX_SUM_FLOW:0) + + (data.yearData.MAX_RETURN_AMNT?data.yearData.MAX_RETURN_AMNT:0) + ); + const yearMin = data.yearData===null ? '' : ( + (data.yearData.MIN_INFL_AMNT?data.yearData.MIN_INFL_AMNT:0) + + (data.yearData.MIN_SUM_FLOW?data.yearData.MIN_SUM_FLOW:0) + + (data.yearData.MIN_RETURN_AMNT?data.yearData.MIN_RETURN_AMNT:0) + ); operationalStatusList[0].yearAvg = yearAvg; operationalStatusList[0].yearMax = yearMax; @@ -1140,18 +1151,15 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) // 여름 operationalStatusList[0].summerAll = data.summer === null ? '' : ( (data.summer.AVG_INFL_AMNT ? data.summer.AVG_INFL_AMNT : 0) + - (data.summer.AVG_SUM_FLOW ? data.summer.AVG_SUM_FLOW : 0) + - (data.summer.AVG_TP_INFL_WQLT_TP ? data.summer.AVG_TP_INFL_WQLT_TP : 0) + (data.summer.AVG_SUM_FLOW ? data.summer.AVG_SUM_FLOW : 0) ); operationalStatusList[0].summerThree = data.summerRainy === null ? '' : ( (data.summerRainy.AVG_INFL_AMNT ? data.summerRainy.AVG_INFL_AMNT : 0) + - (data.summerRainy.AVG_SUM_FLOW ? data.summerRainy.AVG_SUM_FLOW : 0) + - (data.summerRainy.AVG_TP_INFL_WQLT_TP ? data.summerRainy.AVG_TP_INFL_WQLT_TP : 0) + (data.summerRainy.AVG_SUM_FLOW ? data.summerRainy.AVG_SUM_FLOW : 0) ); operationalStatusList[0].summerRain = data.summerSunny === null ? '' : ( (data.summerSunny.AVG_INFL_AMNT ? data.summerSunny.AVG_INFL_AMNT : 0) + - (data.summerSunny.AVG_SUM_FLOW ? data.summerSunny.AVG_SUM_FLOW : 0) + - (data.summerSunny.AVG_TP_INFL_WQLT_TP ? data.summerSunny.AVG_TP_INFL_WQLT_TP : 0) + (data.summerSunny.AVG_SUM_FLOW ? data.summerSunny.AVG_SUM_FLOW : 0) ); // 겨울 operationalStatusList[0].winterAll = data.winter === null ? '' : ( @@ -1251,17 +1259,6 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) } }); - operationalStatusList[0].yearAvg = roundUp(Number(operationalStatusList[0].yearAvg) + (yearSumFlow&&Number(yearSumFlow) != 0?Number(yearSumFlow / yearDay):0), 0); - operationalStatusList[0].yearMax = roundUp(Number(operationalStatusList[0].yearMax) + Number(maxYearSumFlow), 0); - operationalStatusList[0].yearMin = roundUp(Number(operationalStatusList[0].yearMin) + Number(minYearSumFlow), 0); - operationalStatusList[0].summerAll = roundUp(Number(operationalStatusList[0].summerAll) + (summerSumFlow&&Number(summerSumFlow)!=0?Number(summerSumFlow / summerDay):0), 0); - operationalStatusList[0].summerThree = roundUp(Number(operationalStatusList[0].summerThree) + (summerRainDaySumFlow&&Number(summerRainDaySumFlow)!=0?Number(summerRainDaySumFlow / summerRainDay):0), 0); - operationalStatusList[0].summerRain = roundUp(Number(operationalStatusList[0].summerRain) + (summerChungchunSumFlow&&Number(summerChungchunSumFlow)!=0?Number(summerChungchunSumFlow / summerChungchunDay):0), 0); - operationalStatusList[0].winterAll = roundUp(Number(operationalStatusList[0].winterAll) + (winterSumFlow&&Number(winterSumFlow)!=0?Number(winterSumFlow / winterDay):0), 0); - operationalStatusList[0].winterSunnyMin = roundUp(Number(operationalStatusList[0].winterSunnyMin) + Number(minWinterChungchunSumFlow), 0); - operationalStatusList[0].winterSunnyMax = roundUp(Number(operationalStatusList[0].winterSunnyMax) + (winterChungchunSumFlow&&Number(winterChungchunSumFlow)!=0?Number(winterChungchunSumFlow / winterChungchuDay):0), 0); - operationalStatusList[0].winterSunnyAvg = roundUp(Number(operationalStatusList[0].winterSunnyAvg) + Number(maxWinterChungchunSumFlow), 0); - // 연계처리수 yearAvgSumFlow = Number((yearSumFlow&&Number(yearSumFlow)!=0)?(yearSumFlow / yearDay):''); yearMaxSumFlow = maxYearSumFlow; @@ -1274,6 +1271,17 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) winterSunnyAvg = winterChungchunSumFlow&&Number(winterChungchunSumFlow)!=0?(winterChungchunSumFlow / winterChungchuDay):0; winterSunnyMax = maxWinterChungchunSumFlow; + operationalStatusList[0].yearAvg = roundUp(Number(operationalStatusList[0].yearAvg), 0) + roundUp(yearAvgSumFlow, 0); + operationalStatusList[0].yearMax = roundUp(Number(operationalStatusList[0].yearMax), 0) + roundUp(yearMaxSumFlow, 0); + operationalStatusList[0].yearMin = roundUp(Number(operationalStatusList[0].yearMin), 0) + roundUp(yearMinSumFlow, 0); + operationalStatusList[0].summerAll = roundUp(Number(operationalStatusList[0].summerAll), 0) + roundUp(summerAll, 0); + operationalStatusList[0].summerThree = roundUp(Number(operationalStatusList[0].summerThree), 0) + roundUp(summerThree, 0); + operationalStatusList[0].summerRain = roundUp(Number(operationalStatusList[0].summerRain), 0) + roundUp(summerRain, 0); + operationalStatusList[0].winterAll = roundUp(Number(operationalStatusList[0].winterAll), 0) + roundUp(winterAll, 0); + operationalStatusList[0].winterSunnyMin = roundUp(Number(operationalStatusList[0].winterSunnyMin), 0) + roundUp(winterSunnyMin, 0); + operationalStatusList[0].winterSunnyMax = roundUp(Number(operationalStatusList[0].winterSunnyMax), 0) + roundUp(winterSunnyMax, 0); + operationalStatusList[0].winterSunnyAvg = roundUp(Number(operationalStatusList[0].winterSunnyAvg), 0) + roundUp(winterSunnyAvg, 0); + // 지하수유입량 const usage = chungcunSumFlow / calData.length; const summerUsage = sumSummerChungcunFlow / summerChungchunDay; @@ -1295,7 +1303,6 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) const summerLowRain = data.summerBod&&data.summerBod.INFO_RN_DAY&&data.summerBod.INFO_RN_DAY!='null'?Number(data.summerBod.INFO_RN_DAY):0; operationalStatusList[0].rdi = winterAvgBod===0?0:roundUp(summerLowFlow * ((winterAvgBod - summerLowBod) / winterAvgBod), 2); operationalStatusList[0].rdiRain = summerLowRain; - dataFormSetting(operationalStatusList[0]); } if(operationalStatusList[0] && operationalStatusList[7]){ @@ -1338,9 +1345,54 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) operationalStatusList[2].winterSunnyMax = winterSunnyMax; dataFormSetting(operationalStatusList[2]); } + + if (operationalStatusList[0]) { + // 안전하게 숫자 변환하는 함수 + const toNum = (val) => { + if (val === null || val === undefined || val === '' || val === '0') return 0; + return Number(val.toString().replaceAll(',', '')) || 0; + }; + + operationalStatusList[0].summerAll = + toNum(operationalStatusList[1]?.summerAll) + + toNum(operationalStatusList[2]?.summerAll) + + toNum(operationalStatusList[3]?.summerAll); + + operationalStatusList[0].summerThree = + toNum(operationalStatusList[1]?.summerThree) + + toNum(operationalStatusList[2]?.summerThree) + + toNum(operationalStatusList[3]?.summerThree); + + operationalStatusList[0].summerRain = + toNum(operationalStatusList[1]?.summerRain) + + toNum(operationalStatusList[2]?.summerRain) + + toNum(operationalStatusList[3]?.summerRain); + + operationalStatusList[0].winterAll = + toNum(operationalStatusList[1]?.winterAll) + + toNum(operationalStatusList[2]?.winterAll) + + toNum(operationalStatusList[3]?.winterAll); + + operationalStatusList[0].winterSunnyMin = + toNum(operationalStatusList[1]?.winterSunnyMin) + + toNum(operationalStatusList[2]?.winterSunnyMin) + + toNum(operationalStatusList[3]?.winterSunnyMin); + + operationalStatusList[0].winterSunnyMax = + toNum(operationalStatusList[1]?.winterSunnyMax) + + toNum(operationalStatusList[2]?.winterSunnyMax) + + toNum(operationalStatusList[3]?.winterSunnyMax); + + operationalStatusList[0].winterSunnyAvg = + toNum(operationalStatusList[1]?.winterSunnyAvg) + + toNum(operationalStatusList[2]?.winterSunnyAvg) + + toNum(operationalStatusList[3]?.winterSunnyAvg); + + dataFormSetting(operationalStatusList[0]); + } } - // + // 총인설비가 없을 경우 제외 if(data.yearData.TP_INFL_WQLT_TP === null || data.yearData.TP_INFL_WQLT_TP === undefined || data.yearData.TP_INFL_WQLT_TP === 'null') { operationalStatusList = operationalStatusList.slice(0, 10); } From af8677d5105b2ac2ca28c69ebedcf4d918185c12 Mon Sep 17 00:00:00 2001 From: jsyang <mind-one003@mind-one.co.kr> Date: Fri, 22 Aug 2025 13:51:10 +0900 Subject: [PATCH 11/35] =?UTF-8?q?-=20=EC=98=A4=EC=88=98=EC=A0=84=ED=99=98?= =?UTF-8?q?=EC=9C=A8=20=EA=B3=B5=ED=86=B5=EB=B3=80=EC=88=98=EB=A1=9C=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1=20-=20OSU=5FPERCENT=20-=20CalcRainEffect=20?= =?UTF-8?q?=EA=B0=95=EC=9A=B0=EC=98=81=ED=96=A5=EC=9D=BC=EB=A7=8C,=20?= =?UTF-8?q?=EA=B0=95=EC=9A=B0=EB=9F=89=EB=A7=8C=20=EA=B3=84=EC=82=B0?= =?UTF-8?q?=EB=90=98=EB=8F=84=EB=A1=9D=20=ED=8C=8C=EB=9D=BC=EB=AF=B8?= =?UTF-8?q?=ED=84=B0=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/components/common/CalcRainEffect.tsx | 47 ++++++++++--------- .../facilityPrecipitation/modal/page.tsx | 2 +- apps/fo/app/store/common/index.tsx | 3 ++ apps/fo/app/store/dashboard/index.tsx | 8 ++-- apps/fo/app/store/sewageOccur/index.tsx | 5 +- apps/fo/app/store/underWaterInput/index.tsx | 31 ++++++------ 6 files changed, 53 insertions(+), 43 deletions(-) diff --git a/apps/fo/app/components/common/CalcRainEffect.tsx b/apps/fo/app/components/common/CalcRainEffect.tsx index b31470850..bd6e39185 100644 --- a/apps/fo/app/components/common/CalcRainEffect.tsx +++ b/apps/fo/app/components/common/CalcRainEffect.tsx @@ -5,11 +5,12 @@ * * 2.강우영향일이면서 3mm이하의 강우량일 경우에는 강우영향을 준 날의 강우량을 따름 * @param data - * @param weather (default:ALL) + * @param weather (default:ALL), SUNNY, ..etc + * @param chagePart (default:ALL), RAIN_DAY, RAIN_AMNT * @author jsyang */ -export default function CalcRainEffect(data : any, weather='ALL') { +export default function CalcRainEffect(data : any, weather='ALL', changePart='ALL') { console.log("%c Calculate RainEffect !" , "background:blue;color:white"); console.log("%c Data Length :"+data.length+" Weather : "+weather , "background:yellow;color:blue"); // 강우영향일 계산 (강우량이 3 초과이면 무조건 강우영향일) @@ -30,30 +31,34 @@ export default function CalcRainEffect(data : any, weather='ALL') { } } - // 이틀 전, 하루 전이 강우영향일(3 이상)인 경우 해당 날도 강우영향일로 설정 - for(let idx = 0; idx < data.length; idx++) { - if(data[idx]) { - // 하루 전이 강우영향일(3 이상)인 경우 - if(idx > 0 && data[idx-1]?.infoRnDay && Number(data[idx-1]?.infoRnDay) >= 3) { - data[idx]!.rainEffectDay = 1; - } - // 이틀 전이 강우영향일(3 이상)인 경우 - if(idx > 1 && data[idx-2]?.infoRnDay && Number(data[idx-2]?.infoRnDay) >= 3) { - data[idx]!.rainEffectDay = 1; + if(['ALL', 'RAIN_DAY'].includes(changePart)) { + // 이틀 전, 하루 전이 강우영향일(3 이상)인 경우 해당 날도 강우영향일로 설정 + for(let idx = 0; idx < data.length; idx++) { + if(data[idx]) { + // 하루 전이 강우영향일(3 이상)인 경우 + if(idx > 0 && data[idx-1]?.infoRnDay && Number(data[idx-1]?.infoRnDay) >= 3) { + data[idx]!.rainEffectDay = 1; + } + // 이틀 전이 강우영향일(3 이상)인 경우 + if(idx > 1 && data[idx-2]?.infoRnDay && Number(data[idx-2]?.infoRnDay) >= 3) { + data[idx]!.rainEffectDay = 1; + } } } } - for(let idx = 0; idx < data.length; idx++) { - if(data[idx] && data[idx]?.rainEffectDay === 1) { - if(idx > 1){ - if(data[idx-1]?.infoRnDay && Number(data[idx]?.infoRnDay) < 3 && Number(data[idx-1]?.infoRnDay.toString().trim()) >= 3) { - data[idx]!.infoRnDay = data[idx-1]!.infoRnDay; + if(['ALL', 'RAIN_AMNT'].includes(changePart)){ + for(let idx = 0; idx < data.length; idx++) { + if(data[idx] && data[idx]?.rainEffectDay === 1) { + if(idx > 1){ + if(data[idx-1]?.infoRnDay && Number(data[idx]?.infoRnDay) < 3 && Number(data[idx-1]?.infoRnDay.toString().trim()) >= 3) { + data[idx]!.infoRnDay = data[idx-1]!.infoRnDay; + } } - } - if(idx > 2){ - if(data[idx-2]?.infoRnDay && Number(data[idx]?.infoRnDay) < 3 && Number(data[idx-2]?.infoRnDay.toString().trim()) >= 3) { - data[idx]!.infoRnDay = data[idx-2]!.infoRnDay; + if(idx > 2){ + if(data[idx-2]?.infoRnDay && Number(data[idx]?.infoRnDay) < 3 && Number(data[idx-2]?.infoRnDay.toString().trim()) >= 3) { + data[idx]!.infoRnDay = data[idx-2]!.infoRnDay; + } } } } diff --git a/apps/fo/app/pages/(with-layout)/facilityPrecipitation/modal/page.tsx b/apps/fo/app/pages/(with-layout)/facilityPrecipitation/modal/page.tsx index 0b4ef5830..e7659f672 100644 --- a/apps/fo/app/pages/(with-layout)/facilityPrecipitation/modal/page.tsx +++ b/apps/fo/app/pages/(with-layout)/facilityPrecipitation/modal/page.tsx @@ -122,7 +122,7 @@ export default function PrecipitationModal(props: PrecipitationModalProps) { const filteredList = props.detailList .map(i => ({ ...i })) // ← 얕은 복제 .filter((item) => props.facilityCd === item.bscFctCd); - const calcData = CalcRainEffect(filteredList); + const calcData = CalcRainEffect(filteredList, 'ALL', 'RAIN_DAY'); setFilteredDetailList(calcData); setCopyDetailList(calcData); diff --git a/apps/fo/app/store/common/index.tsx b/apps/fo/app/store/common/index.tsx index 5646ea126..d88c621e8 100644 --- a/apps/fo/app/store/common/index.tsx +++ b/apps/fo/app/store/common/index.tsx @@ -201,6 +201,9 @@ const selectMiddleRegionData: SelectDataType[] = [ { text: "전체", val: '0' } ]; +// 오수전환율 +export const OSU_PERCENT = 0.9; + /** * 반올림 함수 * @param value : 대상 숫자 diff --git a/apps/fo/app/store/dashboard/index.tsx b/apps/fo/app/store/dashboard/index.tsx index ea751542f..26e7a26eb 100644 --- a/apps/fo/app/store/dashboard/index.tsx +++ b/apps/fo/app/store/dashboard/index.tsx @@ -4,7 +4,7 @@ import { getFetch } from "@/app/components/api"; import DataForm from "@/app/components/common/DataForm"; -import { fetchPlanInfo, roundUp } from "../common"; +import { fetchPlanInfo, OSU_PERCENT, roundUp } from "../common"; import type { FacilityWaterQltyProps } from "../facilityWaterQlty"; import { type ApiResponse, type FlowDataItem } from "../underWaterInput"; import CalcRainEffect from "@/app/components/common/CalcRainEffect"; @@ -1287,9 +1287,9 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) const summerUsage = sumSummerChungcunFlow / summerChungchunDay; const winterUsage = sumWinterChungcunFlow / winterChungchuDay; - operationalStatusList[0].groundWaterAvg = Math.round((usage-(usage*0.65*0.8)) * 100) / 100; - operationalStatusList[0].groundWaterSummer = Math.round((summerUsage-(summerUsage*0.65*0.8)) * 100) / 100; - operationalStatusList[0].groundWaterWinter = Math.round((winterUsage-(winterUsage*0.65*0.8)) * 100) / 100; + operationalStatusList[0].groundWaterAvg = Math.round((usage-(usage*0.65*OSU_PERCENT)) * 100) / 100; + operationalStatusList[0].groundWaterSummer = Math.round((summerUsage-(summerUsage*0.65*OSU_PERCENT)) * 100) / 100; + operationalStatusList[0].groundWaterWinter = Math.round((winterUsage-(winterUsage*0.65*OSU_PERCENT)) * 100) / 100; //operationalStatusList[0].groundWaterAvg = calData.length === 0 ? '' : Number(calData[0].inflAmnt) - (Number(calData[0].inflAmnt)*0.65*0.8); //operationalStatusList[0].groundWaterSummer = calData.length === 0 ? '' : Number(calData[0].inflAmnt) - (Number(calData[0].inflAmnt)*0.65*0.8); diff --git a/apps/fo/app/store/sewageOccur/index.tsx b/apps/fo/app/store/sewageOccur/index.tsx index 5645c89bc..d72718736 100644 --- a/apps/fo/app/store/sewageOccur/index.tsx +++ b/apps/fo/app/store/sewageOccur/index.tsx @@ -2,6 +2,7 @@ import DataForm from "@/app/components/common/DataForm"; import type { TableUpperProps } from "../dashboard"; import { getFetch } from "@/app/components/api"; import CalcRainEffect from "@/app/components/common/CalcRainEffect"; +import { OSU_PERCENT } from "../common"; export type { TableUpperProps }; /**==================================== * Store - 타입 @@ -345,8 +346,8 @@ export const sewageOccurReducer:(set:any)=>SewageOccurActions=(set: any) => { tableData.push({ msrDt: item.yr+'-'+(index+1>=10?String(index+1):'0'+(index+1)), waterUsage: Math.round(item.usege*1) /1, - swageChangePercent: (Math.round((item.usege/item.usege*0.9) * 100) / 100) * 100, - estimationSewage: Math.round(item.usege*0.9 * 1) / 1 + swageChangePercent: (Math.round((item.usege/item.usege*OSU_PERCENT) * 100) / 100) * 100, + estimationSewage: Math.round(item.usege*OSU_PERCENT * 1) / 1 }) if (item.usege > maxWaterUsage) { maxWaterUsage = item.usege; diff --git a/apps/fo/app/store/underWaterInput/index.tsx b/apps/fo/app/store/underWaterInput/index.tsx index 1587d6933..569919615 100644 --- a/apps/fo/app/store/underWaterInput/index.tsx +++ b/apps/fo/app/store/underWaterInput/index.tsx @@ -3,6 +3,7 @@ import DataForm from "@/app/components/common/DataForm"; import type { TableUpperProps } from "../dashboard"; import type { ExcelType, UnderWaterInputModalProps, UnderWaterProps } from "./types"; import CalcRainEffect from "@/app/components/common/CalcRainEffect"; +import { OSU_PERCENT } from "../common"; export type { TableUpperProps }; // SewageOccurDetailProps 타입을 여기에 정의 @@ -306,20 +307,20 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy sumWinterChungcunFlow += flowItem.inflAmnt && flowItem.inflAmnt !== 'x' ? Number(flowItem.inflAmnt.toString().trim()) : 0; } }); - const usage = chungcunSumFlow / calData.length; const summerUsage = sumSummerChungcunFlow / sumSummerChungcunDay; const winterUsage = sumWinterChungcunFlow / sumWinterChungcunDay; - if(bscFctCd === '11200PB001R') { + //bscFctCd === '11200PB001R') 중랑 - 테스트할 때 코드넣고 해야 보기편해요~ + /* if(bscFctCd === '11200PB001R') { console.log('calData.length : ', calData.length); console.log('usage : ', usage, 'summerUsage : ', summerUsage, 'winterUsage : ', winterUsage); - } + } */ - item.underWaterInputYear = Math.round((usage-(usage*0.65*0.9)) * 1) / 1; - item.underWaterInputSummer = Math.round((summerUsage-(summerUsage*0.65*0.9)) * 1) / 1; - item.underWaterInputWinter = Math.round((winterUsage-(winterUsage*0.65*0.9)) * 1) / 1; - item.properYn = Math.round( (Number(usage-(usage*0.65*0.9)) / Number(item.inflAmnt)) * 100 * 1 ) / 1 > 20?'초과유입':'적정'; + item.underWaterInputYear = Math.round((usage-(usage*0.65*OSU_PERCENT)) * 1) / 1; + item.underWaterInputSummer = Math.round((summerUsage-(summerUsage*0.65*OSU_PERCENT)) * 1) / 1; + item.underWaterInputWinter = Math.round((winterUsage-(winterUsage*0.65*OSU_PERCENT)) * 1) / 1; + item.properYn = Math.round( (Number(usage-(usage*0.65*OSU_PERCENT)) / Number(item.inflAmnt)) * 100 * 1 ) / 1 > 20?'초과유입':'적정'; return item; })); @@ -406,8 +407,8 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy tableData.push({ msrDt: item.yr+'-'+(index+1>=10?String(index+1):'0'+(index+1)), realSewageInput:Math.round(item.usege*1) /1, - sewageOccur:Math.round(item.usege*0.65*0.9 * 1) / 1, - underWaterInput:Math.round((item.usege-(item.usege*0.65*0.9)) * 1) / 1, + sewageOccur:Math.round(item.usege*0.65*OSU_PERCENT * 1) / 1, + underWaterInput:Math.round((item.usege-(item.usege*0.65*OSU_PERCENT)) * 1) / 1, }) if (item.usege > maxWaterUsage) { maxWaterUsage = item.usege; @@ -432,21 +433,21 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy { msrDt: '평균', realSewageInput:Math.round(avgWaterUsage*1) /1, - sewageOccur:Math.round(avgWaterUsage*0.65*0.9 * 1) / 1, - underWaterInput: Math.round((avgWaterUsage-(avgWaterUsage*0.65*0.9)) * 1) / 1 + sewageOccur:Math.round(avgWaterUsage*0.65*OSU_PERCENT * 1) / 1, + underWaterInput: Math.round((avgWaterUsage-(avgWaterUsage*0.65*OSU_PERCENT)) * 1) / 1 //underWaterInput:Math.round((avgWaterUsage-(avgWaterUsage*0.65*0.8)) * 100) / 100, }, { msrDt: '최대', realSewageInput: Math.round(maxWaterUsage*1) /1, - sewageOccur: Math.round(maxWaterUsage*0.65*0.9 * 1) / 1, - underWaterInput: Math.round((maxWaterUsage-(maxWaterUsage*0.65*0.9)) * 1) / 1, + sewageOccur: Math.round(maxWaterUsage*0.65*OSU_PERCENT * 1) / 1, + underWaterInput: Math.round((maxWaterUsage-(maxWaterUsage*0.65*OSU_PERCENT)) * 1) / 1, }, { msrDt: '최소', realSewageInput: Math.round(minWaterUsage*1) /1, - sewageOccur: Math.round(minWaterUsage*0.65*0.9 * 1) / 1, - underWaterInput: Math.round((minWaterUsage-(minWaterUsage*0.65*0.9)) * 1) / 1, + sewageOccur: Math.round(minWaterUsage*0.65*OSU_PERCENT * 1) / 1, + underWaterInput: Math.round((minWaterUsage-(minWaterUsage*0.65*OSU_PERCENT)) * 1) / 1, }, ...tableData ] From bc5bce31712e7968a21604c3c79ed03be6ad240b Mon Sep 17 00:00:00 2001 From: jsyang <mind-one003@mind-one.co.kr> Date: Fri, 22 Aug 2025 18:23:31 +0900 Subject: [PATCH 12/35] =?UTF-8?q?=EB=8C=80=EC=8B=9C=EB=B3=B4=EB=93=9C=20?= =?UTF-8?q?=ED=95=98=EC=A0=88=EA=B8=B0=20=EA=B0=95=EC=9A=B0=EC=8B=9C=20?= =?UTF-8?q?=EC=9C=A0=EC=9E=85=ED=95=98=EC=88=98=EB=9F=89=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/fo/app/store/dashboard/index.tsx | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/apps/fo/app/store/dashboard/index.tsx b/apps/fo/app/store/dashboard/index.tsx index 26e7a26eb..5ce3d0382 100644 --- a/apps/fo/app/store/dashboard/index.tsx +++ b/apps/fo/app/store/dashboard/index.tsx @@ -3,11 +3,12 @@ */ import { getFetch } from "@/app/components/api"; +import CalcRainEffect from "@/app/components/common/CalcRainEffect"; import DataForm from "@/app/components/common/DataForm"; import { fetchPlanInfo, OSU_PERCENT, roundUp } from "../common"; import type { FacilityWaterQltyProps } from "../facilityWaterQlty"; -import { type ApiResponse, type FlowDataItem } from "../underWaterInput"; -import CalcRainEffect from "@/app/components/common/CalcRainEffect"; +import { fetchFlowRateModalList } from "../flowRate"; +import { type FlowDataItem } from "../underWaterInput"; // selectBox export type SelectDataType = { @@ -1124,6 +1125,8 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) let winterSunnyMin = 1; let winterSunnyAvg = 1; let winterSunnyMax = 1; + + let summerRainInflAmnt = 1; if(data && operationalStatusList){ // 유량 - 유입 @@ -1201,9 +1204,12 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) let minWinterChungchunSumFlow = 9999999; let maxWinterChungchunSumFlow = 0; + // 하수유입량 수정 + let summerRainDayFlow = 0; + // 연계처리수,지하수유입량 const bscFctCd = fcltyCd; - const res2 = await getFetch('fo', '/fclt/flow/' + bscFctCd + '/' + searchYear) as ApiResponse; + const res2 = await fetchFlowRateModalList(bscFctCd, searchYear); yearDay = res2.data?res2.data.length:1; res2.data.forEach((item: FlowDataItem) => { yearSumFlow += item.sumFlow && item.sumFlow !== 'x' ? Number(item.sumFlow.toString().trim()) : 0; @@ -1222,8 +1228,9 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) } }); - const calData = CalcRainEffect(res2.data, 'SUNNY'); - const calRainDate = CalcRainEffect(res2.data, 'RAIN'); + const clone = (arr: any[]) => arr?.map(v => ({ ...v })) ?? []; + const calData = CalcRainEffect(clone(res2.data), 'SUNNY'); + const calRainDate = CalcRainEffect(clone(res2.data), 'RAIN', 'RAIN_DAY'); // 지하수유입량 - 청천시 기준 let chungcunSumFlow = 0; @@ -1254,8 +1261,10 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) // 하절기 강우시 계산 calRainDate.forEach((flowItem: FlowDataItem) => { if(flowItem.msrDt.substring(4,6) === '06' || flowItem.msrDt.substring(4,6) === '07' || flowItem.msrDt.substring(4,6) === '08') { + console.log('rainDay : ', flowItem.msrDt); summerRainDay += 1; summerRainDaySumFlow += flowItem.sumFlow && flowItem.sumFlow !== 'x' ? Number(flowItem.sumFlow.toString().trim()) : 0; + summerRainDayFlow += flowItem.inflAmnt && flowItem.inflAmnt !== 'x' ? Number(flowItem.inflAmnt.toString().trim()) : 0; } }); @@ -1271,6 +1280,9 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) winterSunnyAvg = winterChungchunSumFlow&&Number(winterChungchunSumFlow)!=0?(winterChungchunSumFlow / winterChungchuDay):0; winterSunnyMax = maxWinterChungchunSumFlow; + // 하수유입량 (청천, 강우시) + summerRainInflAmnt = summerRainDayFlow&&Number(summerRainDayFlow)!=0?Number(summerRainDayFlow / summerRainDay):0; + operationalStatusList[0].yearAvg = roundUp(Number(operationalStatusList[0].yearAvg), 0) + roundUp(yearAvgSumFlow, 0); operationalStatusList[0].yearMax = roundUp(Number(operationalStatusList[0].yearMax), 0) + roundUp(yearMaxSumFlow, 0); operationalStatusList[0].yearMin = roundUp(Number(operationalStatusList[0].yearMin), 0) + roundUp(yearMinSumFlow, 0); @@ -1332,6 +1344,11 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) } } + if(operationalStatusList[1]){ + operationalStatusList[1].summerThree = summerRainInflAmnt; + dataFormSetting(operationalStatusList[1]); + } + if(operationalStatusList[2]){ operationalStatusList[2].yearAvg = yearAvgSumFlow; operationalStatusList[2].yearMax = yearMaxSumFlow; From aa54f32ba2fbb8487dc297ddf61e93f1e6d904d1 Mon Sep 17 00:00:00 2001 From: jsyang <mind-one003@mind-one.co.kr> Date: Fri, 22 Aug 2025 18:26:15 +0900 Subject: [PATCH 13/35] =?UTF-8?q?=EB=B9=8C=EB=93=9C=EC=97=90=EB=9F=AC=20?= =?UTF-8?q?=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/flowRate/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/fo/app/store/flowRate/index.tsx b/apps/fo/app/store/flowRate/index.tsx index 35e67815f..c8cf3f504 100644 --- a/apps/fo/app/store/flowRate/index.tsx +++ b/apps/fo/app/store/flowRate/index.tsx @@ -175,7 +175,7 @@ const fetchFlowRateList = async (pageNo: number, pageSize: number, searchYear: s } } -const fetchFlowRateModalList = async (bscFctCd: string, searchYear: string) => { +export const fetchFlowRateModalList = async (bscFctCd: string, searchYear: string) => { try { const url = '/fclt/flow/' + bscFctCd + '/' + searchYear; const res = await getFetch('fo', url); From 1fceb181b7d7d42f3962a035697724e0569f7335 Mon Sep 17 00:00:00 2001 From: jsyang <mind-one003@mind-one.co.kr> Date: Mon, 25 Aug 2025 18:01:17 +0900 Subject: [PATCH 14/35] =?UTF-8?q?=EC=9C=A0=EB=9F=89=ED=98=84=ED=99=A9=20?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EB=A7=9E=EC=B6=94=EB=8A=94=20?= =?UTF-8?q?=EC=9E=91=EC=97=85=20=EC=99=84=EB=A3=8C=20,=20=EC=88=98?= =?UTF-8?q?=EC=A7=88=ED=98=84=ED=99=A9=20=EC=9E=91=EC=97=85=EC=A7=84?= =?UTF-8?q?=ED=96=89=20=EC=98=88=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dashboard/facilityInfo/page.tsx | 4 +- .../(with-layout)/underWaterInput/page.tsx | 2 +- apps/fo/app/store/dashboard/index.tsx | 310 ++++++++++++++++-- 3 files changed, 281 insertions(+), 35 deletions(-) diff --git a/apps/fo/app/pages/(with-layout)/dashboard/facilityInfo/page.tsx b/apps/fo/app/pages/(with-layout)/dashboard/facilityInfo/page.tsx index 85aea5ea6..fa2a97d9e 100644 --- a/apps/fo/app/pages/(with-layout)/dashboard/facilityInfo/page.tsx +++ b/apps/fo/app/pages/(with-layout)/dashboard/facilityInfo/page.tsx @@ -182,7 +182,7 @@ export default function ProcessFacilitySearch({searchYear = '', fcltyList = []}: useEffect(() => { operationalStatusList.map((item: { [key: string]: string | number | boolean },index) => { if(index===8 || index===9 || index===10 || index===11 || index===12 || index===13 || index===14 || index===15){ - item['yearAvg'] = Number(item['yearAvg']).toFixed(3); + /* item['yearAvg'] = Number(item['yearAvg']).toFixed(3); item['yearMax'] = item['yearMax']+'%'; item['yearMin'] = item['yearMin']+'%'; item['summerAll'] = item['summerAll']+'%'; @@ -191,7 +191,7 @@ export default function ProcessFacilitySearch({searchYear = '', fcltyList = []}: item['winterAll'] = item['winterAll']+'%'; item['winterSunnyAvg'] = item['winterSunnyAvg']+'%'; item['winterSunnyMax'] = item['winterSunnyMax']+'%'; - item['winterSunnyMin'] = item['winterSunnyMin']+'%'; + item['winterSunnyMin'] = item['winterSunnyMin']+'%'; */ } }); diff --git a/apps/fo/app/pages/(with-layout)/underWaterInput/page.tsx b/apps/fo/app/pages/(with-layout)/underWaterInput/page.tsx index 458e2c656..2126a31a0 100644 --- a/apps/fo/app/pages/(with-layout)/underWaterInput/page.tsx +++ b/apps/fo/app/pages/(with-layout)/underWaterInput/page.tsx @@ -223,7 +223,7 @@ export default function UnderWaterInput() { <UiTable cellClick={(index: number | undefined) => index !== undefined && cellClick(index)} headName={"지하수유입량 추정"} tableData={mainList} headlist={upheadList} pageSize={10} total={total} resetPageNo={resetPage} onPageChange={handlePageChange} /> </div> </div> - <span className="text-2xl text-gray-500">※연평균 유입하수량 = 연간 지하수유입량/연평균 유입하수량*100 </span><br></br> + <span className="text-2xl text-gray-500">※적정여부 = 연간 지하수유입량/연평균 유입하수량*100 </span><br></br> <span className="text-2xl text-gray-500">※지하수 유입량 = 하수처리장 청천시 실제유입량 - (물사용량 × 오수전환율)</span> </ListDiv> </ContentsDiv> diff --git a/apps/fo/app/store/dashboard/index.tsx b/apps/fo/app/store/dashboard/index.tsx index 5ce3d0382..6776d731b 100644 --- a/apps/fo/app/store/dashboard/index.tsx +++ b/apps/fo/app/store/dashboard/index.tsx @@ -8,7 +8,6 @@ import DataForm from "@/app/components/common/DataForm"; import { fetchPlanInfo, OSU_PERCENT, roundUp } from "../common"; import type { FacilityWaterQltyProps } from "../facilityWaterQlty"; import { fetchFlowRateModalList } from "../flowRate"; -import { type FlowDataItem } from "../underWaterInput"; // selectBox export type SelectDataType = { @@ -734,6 +733,117 @@ const fetchMainGraph = async (searchYear: string|undefined, fcltyCd: string|unde } } +// 수질 데이터 청천시, 강우시 재계산 +/* const calcWaterQltyData = async (data: any[], searchYear : string|undefined, fcltyCd : string|undefined) => { + let orgData = data; + console.log('orgData', orgData); + await fetchMainGraph(searchYear, fcltyCd).then(res => { + if(res.data.count > 0) { + const clone = (arr: any[]) => arr?.map(v => ({ ...v })) ?? []; + const qltyData = res.data; + const qltyChungchunData = CalcRainEffect(clone(qltyData), 'SUNNY', 'RAIN_DAY'); + const qltyRainData = CalcRainEffect(clone(qltyData), 'RAIN', 'RAIN_DAY'); + + // 청천시 변수 + let chungchunAllDay = 0; + let chungchunSummerDay = 0; + let chungchunWinterDay = 0; + + let chungchunInflBodAvg = 0; + let chungchunInflTnAvg = 0; + let chungchunInflTpAvg = 0; + let chungchunInflBodMax = 0; + let chungchunInflTnMax= 0; + let chungchunInflTpMax = 0; + let chungchunInflBodMin = 99999999; + let chungchunInflTnMin = 99999999; + let chungchunInflTpMin = 99999999; + + let chungchunEfflBodAvg = 0; + let chungchunEfflTnAvg = 0; + let chungchunEfflTpAvg = 0; + let chungchunEfflBodMax = 0; + let chungchunEfflTnMax= 0; + let chungchunEfflTpMax = 0; + let chungchunEfflBodMin = 99999999; + let chungchunEfflTnMin = 99999999; + let chungchunEfflTpMin = 99999999; + + // 강우시 변수 + let rainAllDay = 0; + let rainSummerDay = 0; + let rainWinterDay = 0; + + let rainInflBodAvg = 0; + let rainInflTnAvg = 0; + let rainInflTpAvg = 0; + let rainInflBodMax = 0; + let rainInflTnMax= 0; + let rainInflTpMax = 0; + let rainInflBodMin = 99999999; + let rainInflTnMin = 99999999; + let rainInflTpMin = 99999999; + + const nullToZero = (value: any) => { + return value === null || value === undefined || value === '' ? 0 : Number(value); + }; + + // 청천시 + qltyChungchunData.forEach((item: any) => { + chungchunAllDay += 1; + const month = item.msrdt.substring(4, 6); // 월 추출 + if(month === '01' || month === '02'){ + chungchunWinterDay += 1; + + const inflbod = nullToZero(item.inflAssctBfrWqltBod); + const infltn = nullToZero(item.inflAssctBfrWqltTn); + const infltp = nullToZero(item.inflAssctBfrWqltTp); + const effbod = nullToZero(item.efflWqltBod); + const efftn = nullToZero(item.efflWqltTn); + const efftp = nullToZero(item.efflWqltTp); + + chungchunInflBodAvg += inflbod; + chungchunInflTnAvg += infltn; + chungchunInflTpAvg += infltp; + chungchunEfflBodAvg += effbod; + chungchunEfflTnAvg += efftn; + chungchunEfflTpAvg += efftp; + + if(chungchunInflBodMax < inflbod) chungchunInflBodMax = inflbod; + if(chungchunInflTnMax < infltn) chungchunInflTnMax = infltn; + if(chungchunInflTpMax < infltp) chungchunInflTpMax = infltp; + if(chungchunEfflBodMax < effbod) chungchunEfflBodMax = effbod; + if(chungchunEfflTnMax < efftn) chungchunEfflTnMax = efftn; + if(chungchunEfflTpMax < efftp) chungchunEfflTpMax = efftp; + + if(chungchunInflBodMin > inflbod) chungchunInflBodMin = inflbod; + if(chungchunInflTnMin > infltn) chungchunInflTnMin = infltn; + if(chungchunInflTpMin > infltp) chungchunInflTpMin = infltp; + if(chungchunEfflBodMin > effbod) chungchunEfflBodMin = effbod; + if(chungchunEfflTnMin > efftn) chungchunEfflTnMin = efftn; + if(chungchunEfflTpMin > efftp) chungchunEfflTpMin = efftp; + }else if(month === '06' || month === '07' || month === '08'){ + chungchunSummerDay += 1; + } + }); + + orgData[5].winterSunnyAvg = chungchunAllDay > 0 ? '999' : 0; + + // 강우시 + qltyRainData.forEach((item: any) => { + const month = item.msrdt.substring(4, 6); // 월 추출 + if(month === '01' || month === '02'){ + }else if(month === '06' || month === '07' || month === '08'){ + } + }); + + return orgData; + } else { + return orgData; + } + }); +}; */ + /**==================================== * Store - action ====================================*/ @@ -775,7 +885,7 @@ export type DashBoardType = { OperationStatus : { isInit : boolean; upHeadListOperationStatus : TableUpperProps[]; - operationalStatusList : OperationalStatusListProps[]; + operationalStatusList : any; isLoadingOperationStatus : boolean; } @@ -1126,7 +1236,26 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) let winterSunnyAvg = 1; let winterSunnyMax = 1; + // 최대, 최소 총 유입량 (1년 하루 합계의 최대, 최소) + + // 하절기 청천시, 강우시 재계산 리턴값 + let summerChungchunFlow = 1 + let summerChungchunReturnAmnt = 1; + let summerChungchunEfflAmnt = 1; let summerRainInflAmnt = 1; + let summerRainReturnAmnt = 1; + let summerRainEfflAmnt = 1; + + // 동절기 청천시 최대, 최소, 평균 리턴값 + let winterChungchunFlowAvg = 1 ; + let winterChungchunFlowMax = 1 ; + let winterChungchunFlowMin = 1 ; + let winterChungchunReturnAvg = 1 ; + let winterChungchunReturnMax = 1 ; + let winterChungchunReturnMin = 1 ; + let winterChungchunEfflAvg = 1 ; + let winterChungchunEfflMax = 1 ; + let winterChungchunEfflMin = 1 ; if(data && operationalStatusList){ // 유량 - 유입 @@ -1193,32 +1322,47 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) let summerChungchunDay = 0; let winterChungchuDay = 0; + let totFlowMax = 0; + let totFlowMin = 9999999; + let yearSumFlow = 0; let maxYearSumFlow = 0; let minYearSumFlow = 9999999; let summerSumFlow = 0; let summerChungchunSumFlow = 0; let summerRainDaySumFlow = 0; + let summerRainDayFlow = 0; + let summerRainDayReturnFlow = 0; + let summerRainDayEfflFlow = 0; + let winterSumFlow = 0; let winterChungchunSumFlow = 0; let minWinterChungchunSumFlow = 9999999; let maxWinterChungchunSumFlow = 0; - - // 하수유입량 수정 - let summerRainDayFlow = 0; - + // 연계처리수,지하수유입량 const bscFctCd = fcltyCd; const res2 = await fetchFlowRateModalList(bscFctCd, searchYear); yearDay = res2.data?res2.data.length:1; - res2.data.forEach((item: FlowDataItem) => { + res2.data.forEach((item: any) => { yearSumFlow += item.sumFlow && item.sumFlow !== 'x' ? Number(item.sumFlow.toString().trim()) : 0; if(maxYearSumFlow < (item.sumFlow && item.sumFlow !== 'x' ? Number(item.sumFlow.toString().trim()) : 0)) { maxYearSumFlow = item.sumFlow && item.sumFlow !== 'x' ? Number(item.sumFlow.toString().trim()) : 0; } - if(minYearSumFlow > (item.sumFlow && item.sumFlow !== 'x' ? Number(item.sumFlow.toString().trim()) : 0) || minYearSumFlow === 0) { + if(minYearSumFlow > (item.sumFlow && item.sumFlow !== 'x' ? Number(item.sumFlow.toString().trim()) : 0)) { minYearSumFlow = item.sumFlow && item.sumFlow !== 'x' ? Number(item.sumFlow.toString().trim()) : 0; } + + // 1년 최대 총 하수유입량 + let totYearFlow = 0; + totYearFlow = (item.inflAmnt && item.inflAmnt !== 'x' ? Number(item.inflAmnt.toString().trim()) : 0) + (item.sumFlow && item.sumFlow !== 'x' ? Number(item.sumFlow.toString().trim()) : 0) + (item.returnAmnt && item.returnAmnt !== 'x' ? Number(item.returnAmnt.toString().trim()) : 0); + if(totFlowMax < totYearFlow) { + totFlowMax = totYearFlow; + } + if(totFlowMin > totYearFlow || totFlowMin === 0) { + totFlowMin = totYearFlow; + } + if(item.msrDt.substring(4,6) === '06' || item.msrDt.substring(4,6) === '07' || item.msrDt.substring(4,6) === '08') { summerDay += 1; summerSumFlow += item.sumFlow && item.sumFlow !== 'x' ? Number(item.sumFlow.toString().trim()) : 0; @@ -1236,35 +1380,92 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) let chungcunSumFlow = 0; let sumSummerChungcunFlow = 0; let sumWinterChungcunFlow = 0; + + // 하절기 청천시 총인설비 반류수 + let summerChungchunDayReturnAmnt = 0; + // 하절기 청천시 방류수 + let summerChungchunDayEfflAmnt = 0; + + // 동절기 총 유입량 최대, 최소 + let winterChungchunTotalInflAmntMax = 0 ; + let winterChungchunTotalInflAmntMin = 9999999 ; + // 동절기 청천시 하수유입량 최대, 최소 + let winterChungchunDayFlowMax = 0 ; + let winterChungchunDayFlowMin = 9999999 ; + // 동절기 청천시 총인반류수 최대, 최소, 평균 + let winterChungchunDayReturnMax = 0 ; + let winterChungchunDayReturnMin = 9999999 ; + let winterChungchunDayReturnAvg = 0 ; + // 동절기 청천시 방류량 최대, 최소, 평균 + let winterChungchunDayEfflMax = 0 ; + let winterChungchunDayEfflMin = 9999999 ; + let winterChungchunDayEfflAvg = 0; // 하절기, 동절기 청천시 계산 - calData.forEach((flowItem: FlowDataItem) => { + calData.forEach((flowItem: any) => { chungcunSumFlow += flowItem.inflAmnt && flowItem.inflAmnt !== 'x' ? Number(flowItem.inflAmnt.toString().trim()) : 0; if(flowItem.msrDt.substring(4,6) ==='06' || flowItem.msrDt.substring(4,6) ==='07' || flowItem.msrDt.substring(4,6) ==='08'){ summerChungchunDay += 1; summerChungchunSumFlow += flowItem.sumFlow && flowItem.sumFlow !== 'x' ? Number(flowItem.sumFlow.toString().trim()) : 0; sumSummerChungcunFlow += flowItem.inflAmnt && flowItem.inflAmnt !== 'x' ? Number(flowItem.inflAmnt.toString().trim()) : 0; + summerChungchunDayReturnAmnt += flowItem.returnAmnt && flowItem.returnAmnt !== 'x' ? Number(flowItem.returnAmnt.toString().trim()) : 0; + summerChungchunDayEfflAmnt += flowItem.efflAmnt && flowItem.efflAmnt !== 'x' ? Number(flowItem.efflAmnt.toString().trim()) : 0; + }else if(flowItem.msrDt.substring(4,6) ==='01' || flowItem.msrDt.substring(4,6) ==='02'){ - if(minWinterChungchunSumFlow > (flowItem.sumFlow && flowItem.sumFlow !== 'x' ? Number(flowItem.sumFlow.toString().trim()) : 0) || minWinterChungchunSumFlow === 0) { + winterChungchuDay += 1; + winterChungchunSumFlow += flowItem.sumFlow && flowItem.sumFlow !== 'x' ? Number(flowItem.sumFlow.toString().trim()) : 0; + sumWinterChungcunFlow += flowItem.inflAmnt && flowItem.inflAmnt !== 'x' ? Number(flowItem.inflAmnt.toString().trim()) : 0; + winterChungchunDayReturnAvg += flowItem.returnAmnt && flowItem.returnAmnt !== 'x' ? Number(flowItem.returnAmnt.toString().trim()) : 0; + winterChungchunDayEfflAvg += flowItem.efflAmnt && flowItem.efflAmnt !== 'x' ? Number(flowItem.efflAmnt.toString().trim()) : 0; + + let totWinterTotalInflAmnt = 0; + totWinterTotalInflAmnt = (flowItem.inflAmnt && flowItem.inflAmnt !== 'x' ? Number(flowItem.inflAmnt.toString().trim()) : 0) + (flowItem.sumFlow && flowItem.sumFlow !== 'x' ? Number(flowItem.sumFlow.toString().trim()) : 0) + (flowItem.returnAmnt && flowItem.returnAmnt !== 'x' ? Number(flowItem.returnAmnt.toString().trim()) : 0); + if(winterChungchunTotalInflAmntMax < totWinterTotalInflAmnt) { + winterChungchunTotalInflAmntMax = totWinterTotalInflAmnt; + } + if(winterChungchunTotalInflAmntMin > totWinterTotalInflAmnt || winterChungchunTotalInflAmntMin === 0) { + winterChungchunTotalInflAmntMin = totWinterTotalInflAmnt; + } + + if(winterChungchunDayFlowMin > (flowItem.inflAmnt && flowItem.inflAmnt !== 'x' ? Number(flowItem.inflAmnt.toString().trim()) : 0)) { + winterChungchunDayFlowMin = flowItem.inflAmnt && flowItem.inflAmnt !== 'x' ? Number(flowItem.inflAmnt.toString().trim()) : 0; + } + if(winterChungchunDayFlowMax < (flowItem.inflAmnt && flowItem.inflAmnt !== 'x' ? Number(flowItem.inflAmnt.toString().trim()) : 0)) { + winterChungchunDayFlowMax = flowItem.inflAmnt && flowItem.inflAmnt !== 'x' ? Number(flowItem.inflAmnt.toString().trim()) : 0; + } + + if(minWinterChungchunSumFlow > (flowItem.sumFlow && flowItem.sumFlow !== 'x' ? Number(flowItem.sumFlow.toString().trim()) : 0) ) { minWinterChungchunSumFlow = flowItem.sumFlow && flowItem.sumFlow !== 'x' ? Number(flowItem.sumFlow.toString().trim()) : 0; } if(maxWinterChungchunSumFlow < (flowItem.sumFlow && flowItem.sumFlow !== 'x' ? Number(flowItem.sumFlow.toString().trim()) : 0)) { maxWinterChungchunSumFlow = flowItem.sumFlow && flowItem.sumFlow !== 'x' ? Number(flowItem.sumFlow.toString().trim()) : 0; } - winterChungchuDay += 1; - winterChungchunSumFlow += flowItem.sumFlow && flowItem.sumFlow !== 'x' ? Number(flowItem.sumFlow.toString().trim()) : 0; - sumWinterChungcunFlow += flowItem.inflAmnt && flowItem.inflAmnt !== 'x' ? Number(flowItem.inflAmnt.toString().trim()) : 0; + + if(winterChungchunDayReturnMin > (flowItem.returnAmnt && flowItem.returnAmnt !== 'x' ? Number(flowItem.returnAmnt.toString().trim()) : 0)) { + winterChungchunDayReturnMin = flowItem.returnAmnt && flowItem.returnAmnt !== 'x' ? Number(flowItem.returnAmnt.toString().trim()) : 0; + } + if(winterChungchunDayReturnMax < (flowItem.returnAmnt && flowItem.returnAmnt !== 'x' ? Number(flowItem.returnAmnt.toString().trim()) : 0)) { + winterChungchunDayReturnMax = flowItem.returnAmnt && flowItem.returnAmnt !== 'x' ? Number(flowItem.returnAmnt.toString().trim()) : 0; + } + + if(winterChungchunDayEfflMin > (flowItem.efflAmnt && flowItem.efflAmnt !== 'x' ? Number(flowItem.efflAmnt.toString().trim()) : 0)) { + winterChungchunDayEfflMin = flowItem.efflAmnt && flowItem.efflAmnt !== 'x' ? Number(flowItem.efflAmnt.toString().trim()) : 0; + } + if(winterChungchunDayEfflMax < (flowItem.efflAmnt && flowItem.efflAmnt !== 'x' ? Number(flowItem.efflAmnt.toString().trim()) : 0)) { + winterChungchunDayEfflMax = flowItem.efflAmnt && flowItem.efflAmnt !== 'x' ? Number(flowItem.efflAmnt.toString().trim()) : 0; + } } }); // 하절기 강우시 계산 - calRainDate.forEach((flowItem: FlowDataItem) => { + calRainDate.forEach((flowItem: any) => { if(flowItem.msrDt.substring(4,6) === '06' || flowItem.msrDt.substring(4,6) === '07' || flowItem.msrDt.substring(4,6) === '08') { - console.log('rainDay : ', flowItem.msrDt); summerRainDay += 1; summerRainDaySumFlow += flowItem.sumFlow && flowItem.sumFlow !== 'x' ? Number(flowItem.sumFlow.toString().trim()) : 0; summerRainDayFlow += flowItem.inflAmnt && flowItem.inflAmnt !== 'x' ? Number(flowItem.inflAmnt.toString().trim()) : 0; + summerRainDayReturnFlow += flowItem.returnAmnt && flowItem.returnAmnt !== 'x' ? Number(flowItem.returnAmnt.toString().trim()) : 0; + summerRainDayEfflFlow += flowItem.efflAmnt && flowItem.efflAmnt !== 'x' ? Number(flowItem.efflAmnt.toString().trim()) : 0; } }); @@ -1280,18 +1481,43 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) winterSunnyAvg = winterChungchunSumFlow&&Number(winterChungchunSumFlow)!=0?(winterChungchunSumFlow / winterChungchuDay):0; winterSunnyMax = maxWinterChungchunSumFlow; - // 하수유입량 (청천, 강우시) + // 하절기 강우시 계산 + // 하수유입량 (강우시) summerRainInflAmnt = summerRainDayFlow&&Number(summerRainDayFlow)!=0?Number(summerRainDayFlow / summerRainDay):0; + // 총인설비방류수 (강우시) + summerRainReturnAmnt = summerRainDayReturnFlow&&Number(summerRainDayReturnFlow)!=0?Number(summerRainDayReturnFlow / summerRainDay):0; + // 방루량 (강우시) + summerRainEfflAmnt = summerRainDayEfflFlow&&summerRainDayEfflFlow!=0?summerRainDayEfflFlow / summerRainDay:0; + + // 동절기 청천시 계산 + // 하수유입량 (청천시) 평균 + winterChungchunFlowAvg = sumWinterChungcunFlow&&Number(sumWinterChungcunFlow)!=0?(sumWinterChungcunFlow / winterChungchuDay):0; + // 총인반류수 (청천시) 평균 + winterChungchunReturnAvg = winterChungchunDayReturnAvg&&Number(winterChungchunDayReturnAvg)!=0?(winterChungchunDayReturnAvg / winterChungchuDay):0; + // 방류량 (청천시) 평균 + winterChungchunEfflAvg = winterChungchunDayEfflAvg&&Number(winterChungchunDayEfflAvg)!=0?(winterChungchunDayEfflAvg / winterChungchuDay):0; + // 하수유입량 (청천시) 최대 + winterChungchunFlowMax = winterChungchunDayFlowMax; + // 총인반류수 (청천시) 최대 + winterChungchunReturnMax = winterChungchunDayReturnMax; + // 방류량 (청천시) 최대 + winterChungchunEfflMax = winterChungchunDayEfflMax; + // 하수유입량 (청천시) 최소 + winterChungchunFlowMin = winterChungchunDayFlowMin; + // 총인반류수 (청천시) 최소 + winterChungchunReturnMin = winterChungchunDayReturnMin; + // 방류량 (청천시) 최소 + winterChungchunEfflMin = winterChungchunDayEfflMin operationalStatusList[0].yearAvg = roundUp(Number(operationalStatusList[0].yearAvg), 0) + roundUp(yearAvgSumFlow, 0); - operationalStatusList[0].yearMax = roundUp(Number(operationalStatusList[0].yearMax), 0) + roundUp(yearMaxSumFlow, 0); - operationalStatusList[0].yearMin = roundUp(Number(operationalStatusList[0].yearMin), 0) + roundUp(yearMinSumFlow, 0); + operationalStatusList[0].yearMax = roundUp(totFlowMax, 0); // + roundUp(yearMaxSumFlow, 0); + operationalStatusList[0].yearMin = roundUp(totFlowMin, 0); operationalStatusList[0].summerAll = roundUp(Number(operationalStatusList[0].summerAll), 0) + roundUp(summerAll, 0); operationalStatusList[0].summerThree = roundUp(Number(operationalStatusList[0].summerThree), 0) + roundUp(summerThree, 0); operationalStatusList[0].summerRain = roundUp(Number(operationalStatusList[0].summerRain), 0) + roundUp(summerRain, 0); operationalStatusList[0].winterAll = roundUp(Number(operationalStatusList[0].winterAll), 0) + roundUp(winterAll, 0); - operationalStatusList[0].winterSunnyMin = roundUp(Number(operationalStatusList[0].winterSunnyMin), 0) + roundUp(winterSunnyMin, 0); - operationalStatusList[0].winterSunnyMax = roundUp(Number(operationalStatusList[0].winterSunnyMax), 0) + roundUp(winterSunnyMax, 0); + operationalStatusList[0].winterSunnyMin = roundUp(winterChungchunTotalInflAmntMin, 0); + operationalStatusList[0].winterSunnyMax = roundUp(winterChungchunTotalInflAmntMax, 0); operationalStatusList[0].winterSunnyAvg = roundUp(Number(operationalStatusList[0].winterSunnyAvg), 0) + roundUp(winterSunnyAvg, 0); // 지하수유입량 @@ -1299,6 +1525,11 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) const summerUsage = sumSummerChungcunFlow / summerChungchunDay; const winterUsage = sumWinterChungcunFlow / winterChungchuDay; + // 임시 계산변수값들 메인에 대입 + summerChungchunFlow = summerUsage; + summerChungchunReturnAmnt = summerChungchunDayReturnAmnt / summerChungchunDay; + summerChungchunEfflAmnt = summerChungchunDayEfflAmnt / summerChungchunDay; + operationalStatusList[0].groundWaterAvg = Math.round((usage-(usage*0.65*OSU_PERCENT)) * 100) / 100; operationalStatusList[0].groundWaterSummer = Math.round((summerUsage-(summerUsage*0.65*OSU_PERCENT)) * 100) / 100; operationalStatusList[0].groundWaterWinter = Math.round((winterUsage-(winterUsage*0.65*OSU_PERCENT)) * 100) / 100; @@ -1344,11 +1575,17 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) } } + // 순수하수량 if(operationalStatusList[1]){ operationalStatusList[1].summerThree = summerRainInflAmnt; + operationalStatusList[1].summerRain = summerChungchunFlow; + operationalStatusList[1].winterSunnyAvg = winterChungchunFlowAvg; + operationalStatusList[1].winterSunnyMax = winterChungchunFlowMax; + operationalStatusList[1].winterSunnyMin = winterChungchunFlowMin; dataFormSetting(operationalStatusList[1]); } + // 연계처리수 if(operationalStatusList[2]){ operationalStatusList[2].yearAvg = yearAvgSumFlow; operationalStatusList[2].yearMax = yearMaxSumFlow; @@ -1363,6 +1600,26 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) dataFormSetting(operationalStatusList[2]); } + // 총인설비방류수 + if(operationalStatusList[3]){ + operationalStatusList[3].summerThree = summerRainReturnAmnt; + operationalStatusList[3].summerRain = summerChungchunReturnAmnt; + operationalStatusList[3].winterSunnyAvg = winterChungchunReturnAvg; + operationalStatusList[3].winterSunnyMax = winterChungchunReturnMax; + operationalStatusList[3].winterSunnyMin = winterChungchunReturnMin; + dataFormSetting(operationalStatusList[3]); + } + + // 방류수 + if(operationalStatusList[4]){ + operationalStatusList[4].summerThree = summerRainEfflAmnt; + operationalStatusList[4].summerRain = summerChungchunEfflAmnt; + operationalStatusList[4].winterSunnyAvg = winterChungchunEfflAvg; + operationalStatusList[4].winterSunnyMax = winterChungchunEfflMax; + operationalStatusList[4].winterSunnyMin = winterChungchunEfflMin; + dataFormSetting(operationalStatusList[4]); + } + if (operationalStatusList[0]) { // 안전하게 숫자 변환하는 함수 const toNum = (val) => { @@ -1390,16 +1647,6 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) toNum(operationalStatusList[2]?.winterAll) + toNum(operationalStatusList[3]?.winterAll); - operationalStatusList[0].winterSunnyMin = - toNum(operationalStatusList[1]?.winterSunnyMin) + - toNum(operationalStatusList[2]?.winterSunnyMin) + - toNum(operationalStatusList[3]?.winterSunnyMin); - - operationalStatusList[0].winterSunnyMax = - toNum(operationalStatusList[1]?.winterSunnyMax) + - toNum(operationalStatusList[2]?.winterSunnyMax) + - toNum(operationalStatusList[3]?.winterSunnyMax); - operationalStatusList[0].winterSunnyAvg = toNum(operationalStatusList[1]?.winterSunnyAvg) + toNum(operationalStatusList[2]?.winterSunnyAvg) + @@ -1408,10 +1655,9 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) dataFormSetting(operationalStatusList[0]); } } - // 총인설비가 없을 경우 제외 if(data.yearData.TP_INFL_WQLT_TP === null || data.yearData.TP_INFL_WQLT_TP === undefined || data.yearData.TP_INFL_WQLT_TP === 'null') { - operationalStatusList = operationalStatusList.slice(0, 10); + operationalStatusList = operationalStatusList.slice(0, 11); } set((state: DashBoardType) => ({ ...state, From 1b22d55b941db9c1f53e3d2636816388fe38a42c Mon Sep 17 00:00:00 2001 From: jsyang <mind-one003@mind-one.co.kr> Date: Tue, 26 Aug 2025 11:19:29 +0900 Subject: [PATCH 15/35] =?UTF-8?q?=EB=8C=80=EC=8B=9C=EB=B3=B4=EB=93=9C=20?= =?UTF-8?q?=EC=88=98=EC=A7=88=ED=98=84=ED=99=A9=20=ED=8C=9D=EC=97=85?= =?UTF-8?q?=EA=B3=BC=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EB=A7=9E=EC=B6=94?= =?UTF-8?q?=EB=8A=94=20=EC=9E=91=EC=97=85=20=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/fo/app/store/dashboard/index.tsx | 267 +++++++++++++++++--------- 1 file changed, 171 insertions(+), 96 deletions(-) diff --git a/apps/fo/app/store/dashboard/index.tsx b/apps/fo/app/store/dashboard/index.tsx index 6776d731b..2b79adfc7 100644 --- a/apps/fo/app/store/dashboard/index.tsx +++ b/apps/fo/app/store/dashboard/index.tsx @@ -734,115 +734,186 @@ const fetchMainGraph = async (searchYear: string|undefined, fcltyCd: string|unde } // 수질 데이터 청천시, 강우시 재계산 -/* const calcWaterQltyData = async (data: any[], searchYear : string|undefined, fcltyCd : string|undefined) => { - let orgData = data; - console.log('orgData', orgData); - await fetchMainGraph(searchYear, fcltyCd).then(res => { - if(res.data.count > 0) { - const clone = (arr: any[]) => arr?.map(v => ({ ...v })) ?? []; - const qltyData = res.data; - const qltyChungchunData = CalcRainEffect(clone(qltyData), 'SUNNY', 'RAIN_DAY'); - const qltyRainData = CalcRainEffect(clone(qltyData), 'RAIN', 'RAIN_DAY'); +const calcWaterQltyData = async (data: any[], searchYear : string|undefined, fcltyCd : string|undefined) => { + // 데이터 결과값 dataFormat 가공 + const qltyDataSetting = (value: number, day : number, digit: number) => { + const toZero = digit === 1 ? '0.0' : digit === 2 ? '0.00' : '0.000'; + return value > 0 ? roundUp((value/day), digit).toFixed(digit) : toZero; + }; - // 청천시 변수 - let chungchunAllDay = 0; - let chungchunSummerDay = 0; - let chungchunWinterDay = 0; + const orgData = data; + const res = await fetchMainGraph(searchYear, fcltyCd); + if(res.data.wqltObjs.length> 0) { + const clone = (arr: any[]) => arr?.map(v => ({ ...v })) ?? []; + const qltyData = res.data.wqltObjs; + const qltyChungchunData = CalcRainEffect(clone(qltyData), 'SUNNY', 'RAIN_DAY'); + const qltyRainData = CalcRainEffect(clone(qltyData), 'RAIN', 'RAIN_DAY'); - let chungchunInflBodAvg = 0; - let chungchunInflTnAvg = 0; - let chungchunInflTpAvg = 0; - let chungchunInflBodMax = 0; - let chungchunInflTnMax= 0; - let chungchunInflTpMax = 0; - let chungchunInflBodMin = 99999999; - let chungchunInflTnMin = 99999999; - let chungchunInflTpMin = 99999999; + // (1) 청천시 변수 + // (1-1) 날짜 count + let chungchunSummerDay = 0; + let chungchunWinterDay = 0; - let chungchunEfflBodAvg = 0; - let chungchunEfflTnAvg = 0; - let chungchunEfflTpAvg = 0; - let chungchunEfflBodMax = 0; - let chungchunEfflTnMax= 0; - let chungchunEfflTpMax = 0; - let chungchunEfflBodMin = 99999999; - let chungchunEfflTnMin = 99999999; - let chungchunEfflTpMin = 99999999; + // (1-2) 하절기 + let chungchunInflBodAvgSummer = 0; + let chungchunInflTnAvgSummer = 0; + let chungchunInflTpAvgSummer = 0; + let chungchunEfflBodAvgSummer = 0; + let chungchunEfflTnAvgSummer = 0; + let chungchunEfflTpAvgSummer = 0; - // 강우시 변수 - let rainAllDay = 0; - let rainSummerDay = 0; - let rainWinterDay = 0; + // (1-3) 동절기 (최대, 최소, 평균 다 필요) + let chungchunInflBodAvg = 0; + let chungchunInflTnAvg = 0; + let chungchunInflTpAvg = 0; + let chungchunInflBodMax = 0; + let chungchunInflTnMax= 0; + let chungchunInflTpMax = 0; + let chungchunInflBodMin = 99999999; + let chungchunInflTnMin = 99999999; + let chungchunInflTpMin = 99999999; - let rainInflBodAvg = 0; - let rainInflTnAvg = 0; - let rainInflTpAvg = 0; - let rainInflBodMax = 0; - let rainInflTnMax= 0; - let rainInflTpMax = 0; - let rainInflBodMin = 99999999; - let rainInflTnMin = 99999999; - let rainInflTpMin = 99999999; + let chungchunEfflBodAvg = 0; + let chungchunEfflTnAvg = 0; + let chungchunEfflTpAvg = 0; + let chungchunEfflBodMax = 0; + let chungchunEfflTnMax= 0; + let chungchunEfflTpMax = 0; + let chungchunEfflBodMin = 99999999; + let chungchunEfflTnMin = 99999999; + let chungchunEfflTpMin = 99999999; - const nullToZero = (value: any) => { - return value === null || value === undefined || value === '' ? 0 : Number(value); - }; + const nullToZero = (value: any) => { + return value === null || value === undefined || value === '' ? 0 : Number(value); + }; - // 청천시 - qltyChungchunData.forEach((item: any) => { - chungchunAllDay += 1; - const month = item.msrdt.substring(4, 6); // 월 추출 - if(month === '01' || month === '02'){ - chungchunWinterDay += 1; - - const inflbod = nullToZero(item.inflAssctBfrWqltBod); - const infltn = nullToZero(item.inflAssctBfrWqltTn); - const infltp = nullToZero(item.inflAssctBfrWqltTp); - const effbod = nullToZero(item.efflWqltBod); - const efftn = nullToZero(item.efflWqltTn); - const efftp = nullToZero(item.efflWqltTp); + // 청천시 + qltyChungchunData.forEach((item: any) => { + const month = item.msrDt.substring(4, 6); // 월 추출 + if(month === '01' || month === '02'){ + chungchunWinterDay += 1; + + const inflbod = nullToZero(item.inflAssctBfrWqltBod); + const infltn = nullToZero(item.inflAssctBfrWqltTn); + const infltp = nullToZero(item.inflAssctBfrWqltTp); + const effbod = nullToZero(item.efflWqltBod); + const efftn = nullToZero(item.efflWqltTn); + const efftp = nullToZero(item.efflWqltTp); - chungchunInflBodAvg += inflbod; - chungchunInflTnAvg += infltn; - chungchunInflTpAvg += infltp; - chungchunEfflBodAvg += effbod; - chungchunEfflTnAvg += efftn; - chungchunEfflTpAvg += efftp; + chungchunInflBodAvg += inflbod; + chungchunInflTnAvg += infltn; + chungchunInflTpAvg += infltp; + chungchunEfflBodAvg += effbod; + chungchunEfflTnAvg += efftn; + chungchunEfflTpAvg += efftp; - if(chungchunInflBodMax < inflbod) chungchunInflBodMax = inflbod; - if(chungchunInflTnMax < infltn) chungchunInflTnMax = infltn; - if(chungchunInflTpMax < infltp) chungchunInflTpMax = infltp; - if(chungchunEfflBodMax < effbod) chungchunEfflBodMax = effbod; - if(chungchunEfflTnMax < efftn) chungchunEfflTnMax = efftn; - if(chungchunEfflTpMax < efftp) chungchunEfflTpMax = efftp; + if(chungchunInflBodMax < inflbod) chungchunInflBodMax = inflbod; + if(chungchunInflTnMax < infltn) chungchunInflTnMax = infltn; + if(chungchunInflTpMax < infltp) chungchunInflTpMax = infltp; + if(chungchunEfflBodMax < effbod) chungchunEfflBodMax = effbod; + if(chungchunEfflTnMax < efftn) chungchunEfflTnMax = efftn; + if(chungchunEfflTpMax < efftp) chungchunEfflTpMax = efftp; - if(chungchunInflBodMin > inflbod) chungchunInflBodMin = inflbod; - if(chungchunInflTnMin > infltn) chungchunInflTnMin = infltn; - if(chungchunInflTpMin > infltp) chungchunInflTpMin = infltp; - if(chungchunEfflBodMin > effbod) chungchunEfflBodMin = effbod; - if(chungchunEfflTnMin > efftn) chungchunEfflTnMin = efftn; - if(chungchunEfflTpMin > efftp) chungchunEfflTpMin = efftp; - }else if(month === '06' || month === '07' || month === '08'){ - chungchunSummerDay += 1; - } - }); + if(chungchunInflBodMin > inflbod) chungchunInflBodMin = inflbod; + if(chungchunInflTnMin > infltn) chungchunInflTnMin = infltn; + if(chungchunInflTpMin > infltp) chungchunInflTpMin = infltp; + if(chungchunEfflBodMin > effbod) chungchunEfflBodMin = effbod; + if(chungchunEfflTnMin > efftn) chungchunEfflTnMin = efftn; + if(chungchunEfflTpMin > efftp) chungchunEfflTpMin = efftp; + }else if(month === '06' || month === '07' || month === '08'){ + chungchunSummerDay += 1; + + const inflbod = nullToZero(item.inflAssctBfrWqltBod); + const infltn = nullToZero(item.inflAssctBfrWqltTn); + const infltp = nullToZero(item.inflAssctBfrWqltTp); + const effbod = nullToZero(item.efflWqltBod); + const efftn = nullToZero(item.efflWqltTn); + const efftp = nullToZero(item.efflWqltTp); - orgData[5].winterSunnyAvg = chungchunAllDay > 0 ? '999' : 0; + chungchunInflBodAvgSummer += inflbod; + chungchunInflTnAvgSummer += infltn; + chungchunInflTpAvgSummer += infltp; + chungchunEfflBodAvgSummer += effbod; + chungchunEfflTnAvgSummer += efftn; + chungchunEfflTpAvgSummer += efftp; + } + }); - // 강우시 - qltyRainData.forEach((item: any) => { - const month = item.msrdt.substring(4, 6); // 월 추출 - if(month === '01' || month === '02'){ - }else if(month === '06' || month === '07' || month === '08'){ - } - }); + // 청천시 수질 데이터 수정 + // 하절기 + orgData[5].summerRain = qltyDataSetting(chungchunInflBodAvgSummer, chungchunSummerDay, 1); + orgData[6].summerRain = qltyDataSetting(chungchunEfflBodAvgSummer, chungchunSummerDay, 1); + orgData[7].summerRain = qltyDataSetting(chungchunInflTnAvgSummer, chungchunSummerDay, 3); + orgData[8].summerRain = qltyDataSetting(chungchunEfflTnAvgSummer, chungchunSummerDay, 3); + orgData[9].summerRain = qltyDataSetting(chungchunInflTpAvgSummer, chungchunSummerDay, 3); + orgData[10].summerRain = qltyDataSetting(chungchunEfflTpAvgSummer, chungchunSummerDay, 3); - return orgData; - } else { - return orgData; - } - }); -}; */ + // 동절기 + orgData[5].winterSunnyAvg = qltyDataSetting(chungchunInflBodAvg, chungchunWinterDay, 1); + orgData[6].winterSunnyAvg = qltyDataSetting(chungchunEfflBodAvg, chungchunWinterDay, 1); + orgData[7].winterSunnyAvg = qltyDataSetting(chungchunInflTnAvg, chungchunWinterDay, 3); + orgData[8].winterSunnyAvg = qltyDataSetting(chungchunEfflTnAvg, chungchunWinterDay, 3); + orgData[9].winterSunnyAvg = qltyDataSetting(chungchunInflTpAvg, chungchunWinterDay, 3); + orgData[10].winterSunnyAvg = qltyDataSetting(chungchunEfflTpAvg, chungchunWinterDay, 3); + + orgData[5].winterSunnyMax = roundUp(chungchunInflBodMax, 1).toFixed(1); + orgData[6].winterSunnyMax = roundUp(chungchunEfflBodMax, 1).toFixed(1); + orgData[7].winterSunnyMax = roundUp(chungchunInflTnMax, 3).toFixed(3); + orgData[8].winterSunnyMax = roundUp(chungchunEfflTnMax, 3).toFixed(3); + orgData[9].winterSunnyMax = roundUp(chungchunInflTpMax, 3).toFixed(3); + orgData[10].winterSunnyMax = roundUp(chungchunEfflTpMax, 3).toFixed(3); + + orgData[5].winterSunnyMin = chungchunInflBodMin === 99999999 ? '0.0' : roundUp(chungchunInflBodMin, 1).toFixed(1); + orgData[6].winterSunnyMin = chungchunEfflBodMin === 99999999 ? '0.0' : roundUp(chungchunEfflBodMin, 1).toFixed(1); + orgData[7].winterSunnyMin = chungchunInflTnMin === 99999999 ? '0.000' : roundUp(chungchunInflTnMin, 3).toFixed(3); + orgData[8].winterSunnyMin = chungchunEfflTnMin === 99999999 ? '0.000' : roundUp(chungchunEfflTnMin, 3).toFixed(3); + orgData[9].winterSunnyMin = chungchunInflTpMin === 99999999 ? '0.000' : roundUp(chungchunInflTpMin, 3).toFixed(3); + orgData[10].winterSunnyMin = chungchunEfflTpMin === 99999999 ? '0.000' : roundUp(chungchunEfflTpMin, 3).toFixed(3); + + // 강우시 변수 + let rainSummerDay = 0; + + let rainInflBodAvg = 0; + let rainInflTnAvg = 0; + let rainInflTpAvg = 0; + let rainEfflBodAvg = 0; + let rainEfflTnAvg = 0; + let rainEfflTpAvg = 0; + + // 강우시 + qltyRainData.forEach((item: any) => { + const month = item.msrDt.substring(4, 6); // 월 추출 + if(month === '06' || month === '07' || month === '08'){ + rainSummerDay += 1; + + const inflbod = nullToZero(item.inflAssctBfrWqltBod); + const infltn = nullToZero(item.inflAssctBfrWqltTn); + const infltp = nullToZero(item.inflAssctBfrWqltTp); + const effbod = nullToZero(item.efflWqltBod); + const efftn = nullToZero(item.efflWqltTn); + const efftp = nullToZero(item.efflWqltTp); + + rainInflBodAvg += inflbod; + rainInflTnAvg += infltn; + rainInflTpAvg += infltp; + rainEfflBodAvg += effbod; + rainEfflTnAvg += efftn; + rainEfflTpAvg += efftp; + } + }); + + // 강우시 수질 데이터 수정 + orgData[5].summerThree = qltyDataSetting(rainInflBodAvg, rainSummerDay, 1); + orgData[6].summerThree = qltyDataSetting(rainEfflBodAvg, rainSummerDay, 1); + orgData[7].summerThree = qltyDataSetting(rainInflTnAvg, rainSummerDay, 3); + orgData[8].summerThree = qltyDataSetting(rainEfflTnAvg, rainSummerDay, 3); + orgData[9].summerThree = qltyDataSetting(rainInflTpAvg, rainSummerDay, 3); + orgData[10].summerThree = qltyDataSetting(rainEfflTpAvg, rainSummerDay, 3); + return orgData; + } else { + return orgData; + } +}; /**==================================== * Store - action @@ -1655,6 +1726,10 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) dataFormSetting(operationalStatusList[0]); } } + + const rtnData = await calcWaterQltyData(operationalStatusList, searchYear, fcltyCd); + operationalStatusList = rtnData; + // 총인설비가 없을 경우 제외 if(data.yearData.TP_INFL_WQLT_TP === null || data.yearData.TP_INFL_WQLT_TP === undefined || data.yearData.TP_INFL_WQLT_TP === 'null') { operationalStatusList = operationalStatusList.slice(0, 11); From 537c895ebef7e739477f731926dcebcfdb81933c Mon Sep 17 00:00:00 2001 From: jsyang <mind-one003@mind-one.co.kr> Date: Tue, 26 Aug 2025 11:24:39 +0900 Subject: [PATCH 16/35] =?UTF-8?q?qltyDataSetting=20common=20index=20?= =?UTF-8?q?=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/fo/app/store/common/index.tsx | 11 +++++++++++ apps/fo/app/store/dashboard/index.tsx | 7 +------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/apps/fo/app/store/common/index.tsx b/apps/fo/app/store/common/index.tsx index d88c621e8..bff960099 100644 --- a/apps/fo/app/store/common/index.tsx +++ b/apps/fo/app/store/common/index.tsx @@ -214,6 +214,17 @@ export const roundUp = (value: number, precision: number = 1): number => { return Math.round(value * (10 ** precision)) / (10 ** precision); } +/** + * 수질 데이터 포맷 변경 함수 + * @param value : 수질 데이터 + * @param day : 일수 + * @param digit : 소수점 자리수 + */ +export const qltyDataSetting = (value: number, day : number, digit: number) => { + const toZero = digit === 1 ? '0.0' : digit === 2 ? '0.00' : '0.000'; + return value > 0 ? roundUp((value/day), digit).toFixed(digit) : toZero; +}; + /** * STORE - API */ diff --git a/apps/fo/app/store/dashboard/index.tsx b/apps/fo/app/store/dashboard/index.tsx index 2b79adfc7..d772d72b3 100644 --- a/apps/fo/app/store/dashboard/index.tsx +++ b/apps/fo/app/store/dashboard/index.tsx @@ -5,7 +5,7 @@ import { getFetch } from "@/app/components/api"; import CalcRainEffect from "@/app/components/common/CalcRainEffect"; import DataForm from "@/app/components/common/DataForm"; -import { fetchPlanInfo, OSU_PERCENT, roundUp } from "../common"; +import { fetchPlanInfo, OSU_PERCENT, qltyDataSetting, roundUp } from "../common"; import type { FacilityWaterQltyProps } from "../facilityWaterQlty"; import { fetchFlowRateModalList } from "../flowRate"; @@ -735,11 +735,6 @@ const fetchMainGraph = async (searchYear: string|undefined, fcltyCd: string|unde // 수질 데이터 청천시, 강우시 재계산 const calcWaterQltyData = async (data: any[], searchYear : string|undefined, fcltyCd : string|undefined) => { - // 데이터 결과값 dataFormat 가공 - const qltyDataSetting = (value: number, day : number, digit: number) => { - const toZero = digit === 1 ? '0.0' : digit === 2 ? '0.00' : '0.000'; - return value > 0 ? roundUp((value/day), digit).toFixed(digit) : toZero; - }; const orgData = data; const res = await fetchMainGraph(searchYear, fcltyCd); From 88893eb0bed966fe7ddd3c179b8600d3715d6f2e Mon Sep 17 00:00:00 2001 From: jsyang <mind-one003@mind-one.co.kr> Date: Tue, 26 Aug 2025 13:33:18 +0900 Subject: [PATCH 17/35] =?UTF-8?q?=EC=97=90=EB=9F=AC=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/business_components/src/ui/map/lib/gis.layer.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/common/business_components/src/ui/map/lib/gis.layer.js b/packages/common/business_components/src/ui/map/lib/gis.layer.js index 5f741e75f..9a7ffe55b 100644 --- a/packages/common/business_components/src/ui/map/lib/gis.layer.js +++ b/packages/common/business_components/src/ui/map/lib/gis.layer.js @@ -688,8 +688,6 @@ GisOlLayer.prototype = { }); return source; -<<<<<<< HEAD -======= }, /** * 여러 개의 검색 결과를 GeoJSON으로 표시 @@ -795,7 +793,6 @@ GisOlLayer.prototype = { } if (!isFinite(minX) || !isFinite(minY) || !isFinite(maxX) || !isFinite(maxY)) return null; return [minX, minY, maxX, maxY]; ->>>>>>> iipbs/common/main } }; From 16009272376c0edb4062bb4568a01998a69ccfa1 Mon Sep 17 00:00:00 2001 From: jsyang <mind-one003@mind-one.co.kr> Date: Tue, 26 Aug 2025 14:05:39 +0900 Subject: [PATCH 18/35] =?UTF-8?q?=ED=8C=9D=EC=97=85=20=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=ED=8F=AC=EB=A7=B7=EC=B6=9C=EB=A0=A5=EB=B0=A9?= =?UTF-8?q?=EC=8B=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dashboard/facilityInfo/modal/page.tsx | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/apps/fo/app/pages/(with-layout)/dashboard/facilityInfo/modal/page.tsx b/apps/fo/app/pages/(with-layout)/dashboard/facilityInfo/modal/page.tsx index 94bc28500..c482e8b7c 100644 --- a/apps/fo/app/pages/(with-layout)/dashboard/facilityInfo/modal/page.tsx +++ b/apps/fo/app/pages/(with-layout)/dashboard/facilityInfo/modal/page.tsx @@ -69,22 +69,12 @@ export default function DashBoardChartModal({item='', period='', title='',modalD useEffect(() => { if(period === 'year'){ const filteredData: yearProps[] = modalData.map((item) => { - if(waterQlty.trim().includes('T-N') || waterQlty.trim().includes('T-P')){ return { label: item.waterQlty, - 평균: typeof item.yearAvg === 'string' ? Number(item.yearAvg.replace(/,/g, '')).toFixed(3) : (item.yearAvg || 0), - 최대: typeof item.yearMax === 'string' ? Number(item.yearMax.replace(/,/g, '')).toFixed(3) : (item.yearMax || 0), - 최소: typeof item.yearMin === 'string' ? Number(item.yearMin.replace(/,/g, '')).toFixed(3) : (item.yearMin || 0), + 평균: typeof item.yearAvg === 'string' ? Number(item.yearAvg.replace(/,/g, '')) : (item.yearAvg || 0), + 최대: typeof item.yearMax === 'string' ? Number(item.yearMax.replace(/,/g, '')) : (item.yearMax || 0), + 최소: typeof item.yearMin === 'string' ? Number(item.yearMin.replace(/,/g, '')) : (item.yearMin || 0), } - } - else{ - return { - label: item.waterQlty, - 평균: typeof item.yearAvg === 'string' ? Number(item.yearAvg.replace(/,/g, '')).toFixed(1) : (item.yearAvg || 0), - 최대: typeof item.yearMax === 'string' ? Number(item.yearMax.replace(/,/g, '')).toFixed(1) : (item.yearMax || 0), - 최소: typeof item.yearMin === 'string' ? Number(item.yearMin.replace(/,/g, '')).toFixed(1) : (item.yearMin || 0), - } - } }) if (item === 'flowRate') { setChartData(filteredData.slice(0,5)); From 14c1846fe13a71b82a8c766e506d953f5de7186d Mon Sep 17 00:00:00 2001 From: jsyang <mind-one003@mind-one.co.kr> Date: Tue, 26 Aug 2025 17:38:25 +0900 Subject: [PATCH 19/35] =?UTF-8?q?=EC=B0=A8=ED=8A=B8property=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20(setXAxisYearTick=20-=20=EB=82=A0=EC=A7=9C=20x?= =?UTF-8?q?=EC=B6=95=EC=9D=BC=EA=B2=BD=EC=9A=B0=20(=EB=85=84=EB=8F=84-?= =?UTF-8?q?=EC=9B=94)=EB=B3=84=EB=A1=9C=20=EB=A7=8C=EB=93=A4=EC=96=B4?= =?UTF-8?q?=EC=A3=BC=EB=8A=94=20=EC=86=8D=EC=84=B1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/pages/(with-layout)/dashboard/maingraph/page.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/fo/app/pages/(with-layout)/dashboard/maingraph/page.tsx b/apps/fo/app/pages/(with-layout)/dashboard/maingraph/page.tsx index 375cdbbdf..507ce7aa4 100644 --- a/apps/fo/app/pages/(with-layout)/dashboard/maingraph/page.tsx +++ b/apps/fo/app/pages/(with-layout)/dashboard/maingraph/page.tsx @@ -199,7 +199,7 @@ export default function DashBoardChart({searchYear = '', fcltyList = []}: facili <ListDiv className="h-[300px]"> <Card className="h-full"> <CardContent className="h-full"> - <MainChart chartForm={CHART_FORM.LINE} chartConfig={chartConfig_tptp} chartData={chart_tpTp} chartTitle="총인유입T-P-방류T-P" yFieldText="T-P(mg/L)"></MainChart> + <MainChart chartForm={CHART_FORM.LINE} chartConfig={chartConfig_tptp} chartData={chart_tpTp} chartTitle="총인유입T-P-방류T-P" yFieldText="T-P(mg/L)" setXAxisYearTick={true}></MainChart> </CardContent> </Card> </ListDiv> @@ -207,7 +207,7 @@ export default function DashBoardChart({searchYear = '', fcltyList = []}: facili <ListDiv className="h-[300px]"> <Card className="h-full"> <CardContent className="h-full"> - <MainChart chartForm={CHART_FORM.LINE} chartConfig={chartConfig_tntn} chartData={chart_tntn} chartTitle="유입T-N-방류T-N" yFieldText="T-N(mg/L)"></MainChart> + <MainChart chartForm={CHART_FORM.LINE} chartConfig={chartConfig_tntn} chartData={chart_tntn} chartTitle="유입T-N-방류T-N" yFieldText="T-N(mg/L)" setXAxisYearTick={true}></MainChart> </CardContent> </Card> </ListDiv> @@ -215,7 +215,7 @@ export default function DashBoardChart({searchYear = '', fcltyList = []}: facili <ListDiv className="h-[300px]"> <Card className="h-full"> <CardContent className="h-full"> - <MainChart chartForm={CHART_FORM.LINE} chartConfig={chartConfig_inflBodInflTn} chartData={chart_inflBodInflTn} chartTitle="유입BOD-유입T-N" yFieldText="농도(mg/L)"></MainChart> + <MainChart chartForm={CHART_FORM.LINE} chartConfig={chartConfig_inflBodInflTn} chartData={chart_inflBodInflTn} chartTitle="유입BOD-유입T-N" yFieldText="농도(mg/L)" setXAxisYearTick={true}></MainChart> </CardContent> </Card> </ListDiv> @@ -223,7 +223,7 @@ export default function DashBoardChart({searchYear = '', fcltyList = []}: facili <ListDiv className="h-[300px]"> <Card className="h-full"> <CardContent className="h-full"> - <MainChart chartForm={CHART_FORM.LINE} chartConfig={chartConfig_inflBodInflTp} chartData={chart_inflBodInflTp} chartTitle="유입BOD-유입T-P" yFieldText="농도(mg/L)"></MainChart> + <MainChart chartForm={CHART_FORM.LINE} chartConfig={chartConfig_inflBodInflTp} chartData={chart_inflBodInflTp} chartTitle="유입BOD-유입T-P" yFieldText="농도(mg/L)" setXAxisYearTick={true}></MainChart> </CardContent> </Card> </ListDiv> From 7ddb7dda974a18748f3ae3c7bbc9bf1a9762eac2 Mon Sep 17 00:00:00 2001 From: jsyang <mind-one003@mind-one.co.kr> Date: Tue, 26 Aug 2025 17:47:29 +0900 Subject: [PATCH 20/35] =?UTF-8?q?=EB=9D=BC=EC=9D=B8=EB=B0=94=20=EC=B0=A8?= =?UTF-8?q?=ED=8A=B8property=20=EC=B6=94=EA=B0=80=20(setXAxisYearTick=20-?= =?UTF-8?q?=20=EB=82=A0=EC=A7=9C=20x=EC=B6=95=EC=9D=BC=EA=B2=BD=EC=9A=B0?= =?UTF-8?q?=20(=EB=85=84=EB=8F=84-=EC=9B=94)=EB=B3=84=EB=A1=9C=20=EB=A7=8C?= =?UTF-8?q?=EB=93=A4=EC=96=B4=EC=A3=BC=EB=8A=94=20=EC=86=8D=EC=84=B1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/fo/app/pages/(with-layout)/dashboard/maingraph/page.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/fo/app/pages/(with-layout)/dashboard/maingraph/page.tsx b/apps/fo/app/pages/(with-layout)/dashboard/maingraph/page.tsx index 507ce7aa4..22143b842 100644 --- a/apps/fo/app/pages/(with-layout)/dashboard/maingraph/page.tsx +++ b/apps/fo/app/pages/(with-layout)/dashboard/maingraph/page.tsx @@ -185,14 +185,14 @@ export default function DashBoardChart({searchYear = '', fcltyList = []}: facili <ListDiv className="h-[300px]"> <Card className="h-full"> <CardContent className="h-full"> - <MainChart chartForm={CHART_FORM.LINEBAR} chartConfig={chartConfig_inflowRain} chartData={chart_inflowRain} chartTitle="유입하수량-강수량" yFieldText="유입하수량(m³/일)" yFieldText2="강수량(mm)"></MainChart> + <MainChart chartForm={CHART_FORM.LINEBAR} chartConfig={chartConfig_inflowRain} chartData={chart_inflowRain} chartTitle="유입하수량-강수량" yFieldText="유입하수량(m³/일)" yFieldText2="강수량(mm)" setXAxisYearTick={true}></MainChart> </CardContent> </Card> </ListDiv> <ListDiv className="h-[300px]"> <Card className="h-full"> <CardContent className="h-full"> - <MainChart chartForm={CHART_FORM.LINEBAR} chartConfig={chartConfig_rainBod} chartData={chart_bodRain} chartTitle="유입BOD-강수량" yFieldText="BOD(mg/L)" yFieldText2="강수량(mm)"></MainChart> + <MainChart chartForm={CHART_FORM.LINEBAR} chartConfig={chartConfig_rainBod} chartData={chart_bodRain} chartTitle="유입BOD-강수량" yFieldText="BOD(mg/L)" yFieldText2="강수량(mm)" setXAxisYearTick = {true}></MainChart> </CardContent> </Card> </ListDiv> From 5357a65b912c21c4d4503ca4690d3efb0cf2dbd9 Mon Sep 17 00:00:00 2001 From: jsyang <mind-one003@mind-one.co.kr> Date: Wed, 27 Aug 2025 09:55:42 +0900 Subject: [PATCH 21/35] =?UTF-8?q?=EB=8C=80=EC=8B=9C=EB=B3=B4=EB=93=9C=20tn?= =?UTF-8?q?,tp=20=EB=B6=88=EC=9D=BC=EC=B9=98=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/dashboard/index.tsx | 75 +++++++++++++++++++++++++-- 1 file changed, 71 insertions(+), 4 deletions(-) diff --git a/apps/fo/app/store/dashboard/index.tsx b/apps/fo/app/store/dashboard/index.tsx index d772d72b3..64cef9723 100644 --- a/apps/fo/app/store/dashboard/index.tsx +++ b/apps/fo/app/store/dashboard/index.tsx @@ -736,6 +736,10 @@ const fetchMainGraph = async (searchYear: string|undefined, fcltyCd: string|unde // 수질 데이터 청천시, 강우시 재계산 const calcWaterQltyData = async (data: any[], searchYear : string|undefined, fcltyCd : string|undefined) => { + const nullToZero = (value: any) => { + return value === null || value === undefined || value === '' ? 0 : Number(value); + }; + const orgData = data; const res = await fetchMainGraph(searchYear, fcltyCd); if(res.data.wqltObjs.length> 0) { @@ -744,6 +748,73 @@ const calcWaterQltyData = async (data: any[], searchYear : string|undefined, fcl const qltyChungchunData = CalcRainEffect(clone(qltyData), 'SUNNY', 'RAIN_DAY'); const qltyRainData = CalcRainEffect(clone(qltyData), 'RAIN', 'RAIN_DAY'); + // (0) 전체변수 + let summerDay = 0; + let totalInflBodAvgSummer = 0; + let totalInflTnAvgSummer = 0; + let totalInflTpAvgSummer = 0; + let totalEfflBodAvgSummer = 0; + let totalEfflTnAvgSummer = 0; + let totalEfflTpAvgSummer = 0; + + let winterDay = 0; + let totalInflBodAvgWinter = 0; + let totalInflTnAvgWinter = 0; + let totalInflTpAvgWinter = 0; + let totalEfflBodAvgWinter = 0; + let totalEfflTnAvgWinter = 0; + let totalEfflTpAvgWinter = 0; + + // 전체 대상 + qltyData.forEach((item: any) => { + const month = item.msrDt.substring(4, 6); // 월 추출 + if(month === '01' || month === '02'){ + const inflbod = nullToZero(item.inflAssctBfrWqltBod); + const infltn = nullToZero(item.inflAssctBfrWqltTn); + const infltp = nullToZero(item.inflAssctBfrWqltTp); + const effbod = nullToZero(item.efflWqltBod); + const efftn = nullToZero(item.efflWqltTn); + const efftp = nullToZero(item.efflWqltTp); + + totalInflBodAvgWinter += inflbod; + totalInflTnAvgWinter += infltn; + totalInflTpAvgWinter += infltp; + totalEfflBodAvgWinter += effbod; + totalEfflTnAvgWinter += efftn; + totalEfflTpAvgWinter += efftp; + winterDay += 1; + }else if(month === '06' || month === '07' || month === '08'){ + summerDay += 1; + const inflbod = nullToZero(item.inflAssctBfrWqltBod); + const infltn = nullToZero(item.inflAssctBfrWqltTn); + const infltp = nullToZero(item.inflAssctBfrWqltTp); + const effbod = nullToZero(item.efflWqltBod); + const efftn = nullToZero(item.efflWqltTn); + const efftp = nullToZero(item.efflWqltTp); + + totalInflBodAvgSummer += inflbod; + totalInflTnAvgSummer += infltn; + totalInflTpAvgSummer += infltp; + totalEfflBodAvgSummer += effbod; + totalEfflTnAvgSummer += efftn; + totalEfflTpAvgSummer += efftp; + } + }); + + orgData[5].winterAll = qltyDataSetting(totalInflBodAvgWinter, winterDay, 1); + orgData[6].winterAll = qltyDataSetting(totalEfflBodAvgWinter, winterDay, 1); + orgData[7].winterAll = qltyDataSetting(totalInflTnAvgWinter, winterDay, 3); + orgData[8].winterAll = qltyDataSetting(totalEfflTnAvgWinter, winterDay, 3); + orgData[9].winterAll = qltyDataSetting(totalInflTpAvgWinter, winterDay, 3); + orgData[10].winterAll = qltyDataSetting(totalEfflTpAvgWinter, winterDay, 3); + + orgData[5].summerAll = qltyDataSetting(totalInflBodAvgSummer, summerDay, 1); + orgData[6].summerAll = qltyDataSetting(totalEfflBodAvgSummer, summerDay, 1); + orgData[7].summerAll = qltyDataSetting(totalInflTnAvgSummer, summerDay, 3); + orgData[8].summerAll = qltyDataSetting(totalEfflTnAvgSummer, summerDay, 3); + orgData[9].summerAll = qltyDataSetting(totalInflTpAvgSummer, summerDay, 3); + orgData[10].summerAll = qltyDataSetting(totalEfflTpAvgSummer, summerDay, 3); + // (1) 청천시 변수 // (1-1) 날짜 count let chungchunSummerDay = 0; @@ -778,10 +849,6 @@ const calcWaterQltyData = async (data: any[], searchYear : string|undefined, fcl let chungchunEfflTnMin = 99999999; let chungchunEfflTpMin = 99999999; - const nullToZero = (value: any) => { - return value === null || value === undefined || value === '' ? 0 : Number(value); - }; - // 청천시 qltyChungchunData.forEach((item: any) => { const month = item.msrDt.substring(4, 6); // 월 추출 From 1cdbdd00d9aad369e46f412c248addb9afbb1ecc Mon Sep 17 00:00:00 2001 From: jsyang <mind-one003@mind-one.co.kr> Date: Wed, 27 Aug 2025 17:44:38 +0900 Subject: [PATCH 22/35] =?UTF-8?q?=EB=8B=A4=EC=9A=B4=EB=A1=9C=EB=93=9C=20?= =?UTF-8?q?=EC=97=91=EC=85=80=20=ED=97=A4=EB=8D=94=EC=97=90=20=EB=8B=A8?= =?UTF-8?q?=EC=9C=84=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/store/facilityPrecipitation/index.tsx | 16 ++-- apps/fo/app/store/facilityWaterQlty/index.tsx | 44 +++++------ apps/fo/app/store/flowRate/index.tsx | 26 +++---- apps/fo/app/store/planSewage/index.tsx | 22 +++--- apps/fo/app/store/processArea/index.tsx | 76 +++++++++---------- apps/fo/app/store/processFacility/index.tsx | 14 ++-- apps/fo/app/store/rdi/index.tsx | 32 ++++---- apps/fo/app/store/sewageOccur/index.tsx | 24 +++--- apps/fo/app/store/underWaterInput/index.tsx | 10 +-- apps/fo/app/store/underWaterInput/types.tsx | 10 +-- 10 files changed, 137 insertions(+), 137 deletions(-) diff --git a/apps/fo/app/store/facilityPrecipitation/index.tsx b/apps/fo/app/store/facilityPrecipitation/index.tsx index 47e9a1a1e..77a053fc5 100644 --- a/apps/fo/app/store/facilityPrecipitation/index.tsx +++ b/apps/fo/app/store/facilityPrecipitation/index.tsx @@ -49,11 +49,11 @@ export interface ExcelType { 시군구: string, 시설이름: string, 주소: string, - 시설용량: number, + "시설옹량(m³/일)": number, 관측소정보 : string, - 강우일 : number, - 강우영향일 : number, - 연간총강수량 : number, + "강우일(일)": number, + "강우영향일(일)": number, + "연간총강수량(mm)": number, } /**==================================== @@ -263,11 +263,11 @@ export const facilityPrecipitationReducer:(set:(fn: (state: FacilityPrecipitatio 시군구: item.gugun, 시설이름: item.bscFctNm, 주소: item.addr, - 시설용량: item.fctCpc, + "시설옹량(m³/일)": item.fctCpc, 관측소정보: item.stnKo, - 강우일: item.infoRnDay, - 강우영향일: item.rainEffectDay, - 연간총강수량: item.totalYearRain, + "강우일(일)": item.infoRnDay, + "강우영향일(일)": item.rainEffectDay, + "연간총강수량(mm)": item.totalYearRain, }) }) }else{ diff --git a/apps/fo/app/store/facilityWaterQlty/index.tsx b/apps/fo/app/store/facilityWaterQlty/index.tsx index c63d3f284..0eded855b 100644 --- a/apps/fo/app/store/facilityWaterQlty/index.tsx +++ b/apps/fo/app/store/facilityWaterQlty/index.tsx @@ -65,17 +65,17 @@ export interface ExcelType { 시군구: string, 시설이름: string, 주소: string, - 용량: number, - 유입BOD: string | '', - 유입TOC: string | '', - 유입SS: string | '', - 유입TN: string | '', - 유입TP: string | '', - 유출BOD: string | '', - 유출TOC: string | '', - 유출SS: string | '', - 유출TN: string | '', - 유출TP: string | '', + "시설용량(m³/일)": number, + "유입BOD(mg/L)": string | '', + "유입TOC(mg/L)": string | '', + "유입SS(mg/L)": string | '', + "유입TN(mg/L)": string | '', + "유입TP(mg/L)": string | '', + "유출BOD(mg/L)": string | '', + "유출TOC(mg/L)": string | '', + "유출SS(mg/L)": string | '', + "유출TN(mg/L)": string | '', + "유출TP(mg/L)": string | '', } /** @@ -463,17 +463,17 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType 시군구: item.sggNm, 시설이름: item.bscFctNm, 주소: item.addr, - 용량: item.fctCpc, - 유입BOD: item.inflAssctBfrWqltBod, - 유입TOC: item.inflAssctBfrWqltToc, - 유입SS: item.inflAssctBfrWqltSs, - 유입TN: item.inflAssctBfrWqltTn, - 유입TP: item.inflAssctBfrWqltTp, - 유출BOD: item.efflWqltBod, - 유출TOC: item.efflWqltToc, - 유출SS: item.efflWqltSs, - 유출TN: item.efflWqltTn, - 유출TP: item.efflWqltTp, + "시설용량(m³/일)": item.fctCpc, + "유입BOD(mg/L)": item.inflAssctBfrWqltBod, + "유입TOC(mg/L)": item.inflAssctBfrWqltToc, + "유입SS(mg/L)": item.inflAssctBfrWqltSs, + "유입TN(mg/L)": item.inflAssctBfrWqltTn, + "유입TP(mg/L)": item.inflAssctBfrWqltTp, + "유출BOD(mg/L)": item.efflWqltBod, + "유출TOC(mg/L)": item.efflWqltToc, + "유출SS(mg/L)": item.efflWqltSs, + "유출TN(mg/L)": item.efflWqltTn, + "유출TP(mg/L)": item.efflWqltTp, }); }); }else{ diff --git a/apps/fo/app/store/flowRate/index.tsx b/apps/fo/app/store/flowRate/index.tsx index c8cf3f504..a6580500d 100644 --- a/apps/fo/app/store/flowRate/index.tsx +++ b/apps/fo/app/store/flowRate/index.tsx @@ -37,17 +37,17 @@ export interface ExcelType { 권역:string|'', 단위유역:string|'', 중권역:string|'', + 환경청:string|'', 시도: string, 시군구: string, 시설이름: string, 주소: string, - 용량: number, - 총유입량: number | '', - 하수유입량: number | '', - 연계처리량: number | '', - 총인반류수량: number | '', - 방류량: number | '', - 환경청:string|'', + "시설용량(m³/일)": number, + "총유입량(m³/일)": number | '', + "하수유입량(m³/일)": number | '', + "연계처리량(m³/일)": number | '', + "총인반류수량(m³/일)": number | '', + "방류량(m³/일)": number | '', } export type modalExcelType = { @@ -293,12 +293,12 @@ export const flowRateSearchReducer:(set:(fn: (state: FlowRateSearchType) => Flow 시군구: item.gugun, 시설이름: item.bscFctNm, 주소: item.daddr, - 용량: item.fctCpc, - 총유입량: item.totInflAmnt, - 하수유입량: item.inflAmnt, - 연계처리량: item.sumFlow, - 총인반류수량: item.returnAmnt, - 방류량: item.efflAmnt, + "시설용량(m³/일)": item.fctCpc, + "총유입량(m³/일)": item.totInflAmnt, + "하수유입량(m³/일)": item.inflAmnt, + "연계처리량(m³/일)": item.sumFlow, + "총인반류수량(m³/일)": item.returnAmnt, + "방류량(m³/일)": item.efflAmnt, }); }); } diff --git a/apps/fo/app/store/planSewage/index.tsx b/apps/fo/app/store/planSewage/index.tsx index 36e5feb9f..ccf6c9d73 100644 --- a/apps/fo/app/store/planSewage/index.tsx +++ b/apps/fo/app/store/planSewage/index.tsx @@ -52,7 +52,7 @@ const upHeadList1:TableUpperProps[] = [ { id: "daddr", title: "주소", row:0, rowSpan:2 }, { id: "fctCpc", title: "시설용량(m³/일)", row:0, rowSpan:2, align:'right' }, { id: "spareCapacity", title: "여유용량(m³/일)", row:0, rowSpan:2, align:'right' }, - { id: "variableLoadPercent", title: "변동부하율", row:0, rowSpan:2, align:'right' }, + { id: "variableLoadPercent", title: "변동부하율(%)", row:0, rowSpan:2, align:'right' }, { id: "classifiedSewerPercent", title: "분류식화율(%)", row:0, rowSpan:2, align:'right' }, ]; @@ -65,7 +65,7 @@ const upHeadList2:TableUpperProps[] = [ { id: "daddr", title: "주소", row:0, rowSpan:2 }, { id: "fctCpc", title: "시설용량(m³/일)", row:0, rowSpan:2, align:'right' }, { id: "spareCapacity", title: "여유용량(m³/일)", row:0, rowSpan:2, align:'right' }, - { id: "variableLoadPercent", title: "변동부하율", row:0, rowSpan:2, align:'right' }, + { id: "variableLoadPercent", title: "변동부하율(%)", row:0, rowSpan:2, align:'right' }, { id: "classifiedSewerPercent", title: "분류식화율(%)", row:0, rowSpan:2, align:'right' }, ]; @@ -82,7 +82,7 @@ const upHeadList3:TableUpperProps[] = [ { id: "daddr", title: "주소", row:0, rowSpan:2 }, { id: "fctCpc", title: "시설용량(m³/일)", row:0, rowSpan:2, align:'right' }, { id: "spareCapacity", title: "여유용량(m³/일)", row:0, rowSpan:2, align:'right' }, - { id: "variableLoadPercent", title: "변동부하율", row:0, rowSpan:2, align:'right' }, + { id: "variableLoadPercent", title: "변동부하율(%)", row:0, rowSpan:2, align:'right' }, { id: "classifiedSewerPercent", title: "분류식화율(%)", row:0, rowSpan:2, align:'right' }, ]; @@ -113,10 +113,10 @@ export type ExcelType = { 시군구: string; 시설이름: string; 주소: string; - 시설용량: number; - 여유용량: number; - 변동부하율 : number; - 분류식화율 : number; + "시설용량(m³/일)": number; + "여유용량(m³/일)": number; + "변동부하율(%)" : number; + "분류식화율(%)" : number; } const dataFormSetting=(item : PlanSewageProps)=> { @@ -230,10 +230,10 @@ export const planSewageReducer:(set:(fn: (state: PlanSewageType) => PlanSewageTy 시도: item.sido, 시군구: item.gugun, 주소: item.daddr, - 시설용량: item.fctCpc, - 여유용량: item.spareCapacity, - 변동부하율: item.variableLoadPercent, - 분류식화율: item.classifiedSewerPercent, + "시설용량(m³/일)": item.fctCpc, + "여유용량(m³/일)": item.spareCapacity, + "변동부하율(%)": item.variableLoadPercent, + "분류식화율(%)": item.classifiedSewerPercent, }) }) } diff --git a/apps/fo/app/store/processArea/index.tsx b/apps/fo/app/store/processArea/index.tsx index dc3826fef..ccad3436e 100644 --- a/apps/fo/app/store/processArea/index.tsx +++ b/apps/fo/app/store/processArea/index.tsx @@ -63,25 +63,25 @@ export interface ExcelType { 시설코드: string, 시설명: string, 주소: string, - 시설용량: number | '', - 증설계획기존: number | '', - 증설계획현재: number | '', - 증설계획1단계: number | '', - 증설계획2단계: number | '', - 증설계획3단계: number | '', - 증설계획4단계: number | '', - 처리인구기존: number | '', - 처리인구현재: number | '', - 처리인구1단계: number | '', - 처리인구2단계: number | '', - 처리인구3단계: number | '', - 처리인구4단계: number | '', - 처리구역기존: number | '', - 처리구역현재: number | '', - 처리구역1단계: number | '', - 처리구역2단계: number | '', - 처리구역3단계: number | '', - 처리구역4단계: number | '', + "시설옹량(m³/일)": number | '', + "증설계획기존(m³/일)": number | '', + "증설계획현재(m³/일)": number | '', + "증설계획1단계(m³/일)": number | '', + "증설계획2단계(m³/일)": number | '', + "증설계획3단계(m³/일)": number | '', + "증설계획4단계(m³/일)": number | '', + "처리인구기존(인)": number | '', + "처리인구현재(인)": number | '', + "처리인구1단계(인)": number | '', + "처리인구2단계(인)": number | '', + "처리인구3단계(인)": number | '', + "처리인구4단계(인)": number | '', + "처리구역기존(km²)": number | '', + "처리구역현재(km²)": number | '', + "처리구역1단계(km²)": number | '', + "처리구역2단계(km²)": number | '', + "처리구역3단계(km²)": number | '', + "처리구역4단계(km²)": number | '', 처리구역: string | '' } @@ -385,25 +385,25 @@ export const processAreaReducer:(set:SetStateFunction)=>ProcessAreaActions=(set: 시설코드: item.swtrmtFcltCd, 시설명: item.swtrmtFcltNm, 주소: item.location, - 시설용량: item.fctCpc, - 증설계획기존: item.planSwageQntSumDt4, - 증설계획현재: item.planSwageQntSum, - 증설계획1단계: item.planSwageQntSumDc1, - 증설계획2단계: item.planSwageQntSumDc2, - 증설계획3단계: item.planSwageQntSumDc3, - 증설계획4단계: item.planSwageQntSumDc4, - 처리인구기존: item.swtrmtPpltnCntDt4, - 처리인구현재: item.swtrmtPpltnCnt, - 처리인구1단계: item.swtrmtPpltnCntDc1, - 처리인구2단계: item.swtrmtPpltnCntDc2, - 처리인구3단계: item.swtrmtPpltnCntDc3, - 처리인구4단계: item.swtrmtPpltnCntDc4, - 처리구역기존: item.swtrmtZoneAreaDt4, - 처리구역현재: item.swtrmtZoneArea, - 처리구역1단계: item.swtrmtZoneAreaDc1, - 처리구역2단계: item.swtrmtZoneAreaDc2, - 처리구역3단계: item.swtrmtZoneAreaDc3, - 처리구역4단계: item.swtrmtZoneAreaDc4, + "시설옹량(m³/일)": item.fctCpc, + "증설계획기존(m³/일)": item.planSwageQntSumDt4, + "증설계획현재(m³/일)": item.planSwageQntSum, + "증설계획1단계(m³/일)": item.planSwageQntSumDc1, + "증설계획2단계(m³/일)": item.planSwageQntSumDc2, + "증설계획3단계(m³/일)": item.planSwageQntSumDc3, + "증설계획4단계(m³/일)": item.planSwageQntSumDc4, + "처리인구기존(인)": item.swtrmtPpltnCntDt4, + "처리인구현재(인)": item.swtrmtPpltnCnt, + "처리인구1단계(인)": item.swtrmtPpltnCntDc1, + "처리인구2단계(인)": item.swtrmtPpltnCntDc2, + "처리인구3단계(인)": item.swtrmtPpltnCntDc3, + "처리인구4단계(인)": item.swtrmtPpltnCntDc4, + "처리구역기존(km²)": item.swtrmtZoneAreaDt4, + "처리구역현재(km²)": item.swtrmtZoneArea, + "처리구역1단계(km²)": item.swtrmtZoneAreaDc1, + "처리구역2단계(km²)": item.swtrmtZoneAreaDc2, + "처리구역3단계(km²)": item.swtrmtZoneAreaDc3, + "처리구역4단계(km²)": item.swtrmtZoneAreaDc4, 처리구역: item.trtDstr }); }); diff --git a/apps/fo/app/store/processFacility/index.tsx b/apps/fo/app/store/processFacility/index.tsx index 9a2572916..bb9fdb086 100644 --- a/apps/fo/app/store/processFacility/index.tsx +++ b/apps/fo/app/store/processFacility/index.tsx @@ -44,9 +44,9 @@ export interface ExcelType { 시군구: string, 시설이름: string, 주소: string, - 시설용량: number | '', - 계획유입수질: number | '', - 설계유입수질: number | '', + "시설용량(m³/일)": number | '', + "계획유입수질(mg/L)": number | '', + "설계유입수질(mg/L)": number | '', 공법: string, 가동개시일: string, 준공일: string, @@ -623,13 +623,13 @@ export const processFacilityReducer:(set:SetStateFunction)=>ProcessFacilityActio 시군구: item.gugun, 시설이름: item.bscFctNm, 주소: item.daddr, - 시설용량: item.fctCpc ? Number(item.fctCpc) : '', - 계획유입수질: item.plInflWqltBod ? Number(item.plInflWqltBod) : '', - 설계유입수질: item.dsInflWqltBod ? Number(item.dsInflWqltBod) : '', + "시설용량(m³/일)": item.fctCpc ? Number(item.fctCpc.toString().replaceAll(',','')) : '', + "계획유입수질(mg/L)": item.plInflWqltBod ? Number(item.plInflWqltBod) : '', + "설계유입수질(mg/L)": item.dsInflWqltBod ? Number(item.dsInflWqltBod) : '', 공법: item.trtFrfNm, 가동개시일: item.rnDt, 준공일: item.cmplDt, - 관리대행업자: item.mnstr, + 관리대행업자: item.trstOprEtpNm, }) }) } diff --git a/apps/fo/app/store/rdi/index.tsx b/apps/fo/app/store/rdi/index.tsx index 310130bb0..2c4997010 100644 --- a/apps/fo/app/store/rdi/index.tsx +++ b/apps/fo/app/store/rdi/index.tsx @@ -87,14 +87,14 @@ export interface ExcelType { 시군구: string, 시설명: string, 주소: string, - 시설용량: number, - 청천시유입하수량: string | number | '', - 하절기강우일최저유입BOD: number | '', - 하절기최저유입BOD유입유량: number | string | '', - 동절기청천시유입BOD: number | '', - RDII추정 : number | '', - RDII추정시일강수량 : number | '', - 강우시총추정유입량 : string | number | '', + "시설용량(m³/일)": number, + "청천시유입하수량(m³/일)": string | number | '', + "하절기강우일최저유입BOD(mg/L)": number | '', + "하절기최저유입BOD유입유량(m³/일)": number | string | '', + "동절기청천시유입BOD(mg/L)": number | '', + "RDII추정" : number | '', + "RDII추정시일강수량(mm)": number | '', + "강우시총추정유입량(m³/일)" : string | number | '', 적정여부 : string, } @@ -338,14 +338,14 @@ export const rdiReducer:(set:SetStateFunction)=>RdiActions=(set: SetStateFunctio 시도: item.sido, 시군구: item.sigungo, 주소: item.daddr, - 시설용량: item.fctCpc, - 청천시유입하수량: item.chungchunFlow, - 하절기강우일최저유입BOD: item.summerMinBodValue, - 하절기최저유입BOD유입유량: item.inflAmnt, - 동절기청천시유입BOD: item.winterAvgBodLowRainfall, - RDII추정: item.rdiiValue, - RDII추정시일강수량: item.infoRnDay, - 강우시총추정유입량: item.rainCalInflAmnt, + "시설용량(m³/일)": item.fctCpc, + "청천시유입하수량(m³/일)": item.chungchunFlow, + "하절기강우일최저유입BOD(mg/L)": item.summerMinBodValue, + "하절기최저유입BOD유입유량(m³/일)": item.inflAmnt, + "동절기청천시유입BOD(mg/L)": item.winterAvgBodLowRainfall, + "RDII추정": item.rdiiValue, + "RDII추정시일강수량(mm)": item.infoRnDay, + "강우시총추정유입량(m³/일)": item.rainCalInflAmnt, 적정여부: item.properYn, }); }); diff --git a/apps/fo/app/store/sewageOccur/index.tsx b/apps/fo/app/store/sewageOccur/index.tsx index d72718736..efc51a5af 100644 --- a/apps/fo/app/store/sewageOccur/index.tsx +++ b/apps/fo/app/store/sewageOccur/index.tsx @@ -52,12 +52,12 @@ export interface ExcelType { 시군구: string, 시설명: string, 주소: string, - 시설용량: number, - 물사용량: number | '', - 오수전환율: number | '', - 오수발생량추정: number | '', - 연간하수유입량: number | '', - 청천시하수유입량: number | '', + "시설용량(m³/일)": number, + "물사용량(m³/일)": number | '', + "오수전환율(%)": number | '', + "오수발생량추정(m³/일)": number | '', + "연간하수유입량(m³/일)": number | '', + "청천시하수유입량(m³/일)": number | '', } // 리스트 헤더 @@ -278,12 +278,12 @@ export const sewageOccurReducer:(set:any)=>SewageOccurActions=(set: any) => { 시도: item.sidoNm, 시군구: item.sggNm, 주소: item.daddr, - 시설용량: item.fctCpc, - 물사용량: item.waterUsage, - 오수전환율: item.swageChangePercent, - 오수발생량추정: item.estimationSewage, - 연간하수유입량 : item.sewageInputYear, - 청천시하수유입량 : item.sewageInputChungchun, + "시설용량(m³/일)": item.fctCpc, + "물사용량(m³/일)": item.waterUsage, + "오수전환율(%)": item.swageChangePercent, + "오수발생량추정(m³/일)": item.estimationSewage, + "연간하수유입량(m³/일)": item.sewageInputYear, + "청천시하수유입량(m³/일)": item.sewageInputChungchun, }); }); } diff --git a/apps/fo/app/store/underWaterInput/index.tsx b/apps/fo/app/store/underWaterInput/index.tsx index 569919615..cb80d1942 100644 --- a/apps/fo/app/store/underWaterInput/index.tsx +++ b/apps/fo/app/store/underWaterInput/index.tsx @@ -341,11 +341,11 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy 시군구: item.sggNm, 시설명: item.bscFctNm, 주소: item.daddr, - 시설용량: item.fctCpc, - 평균유입하수량 :item.inflAmnt, - 연간지하수유입량: item.underWaterInputYear, - 하절기지하수유입량: item.underWaterInputSummer, - 동절기지하수유입량: item.underWaterInputWinter, + "시설용량(m³/일)": item.fctCpc, + "평균유입하수량(m³/일)": item.inflAmnt, + "연간지하수유입량(m³/일)": item.underWaterInputYear, + "하절기지하수유입량(m³/일)": item.underWaterInputSummer, + "동절기지하수유입량(m³/일)": item.underWaterInputWinter, 적정여부: item.properYn, }); }); diff --git a/apps/fo/app/store/underWaterInput/types.tsx b/apps/fo/app/store/underWaterInput/types.tsx index 4e13e7c96..396bd631b 100644 --- a/apps/fo/app/store/underWaterInput/types.tsx +++ b/apps/fo/app/store/underWaterInput/types.tsx @@ -55,10 +55,10 @@ export interface ExcelType { 시군구: string, 시설명: string, 주소: string, - 시설용량: number, - 평균유입하수량 : number | '', - 연간지하수유입량: number | '', - 하절기지하수유입량: number | '', - 동절기지하수유입량: number | '', + "시설용량(m³/일)": number, + "평균유입하수량(m³/일)": number | '', + "연간지하수유입량(m³/일)": number | '', + "하절기지하수유입량(m³/일)": number | '', + "동절기지하수유입량(m³/일)": number | '', 적정여부: string | '', } \ No newline at end of file From 1bfc8b6a197958f3c8ae337ab70b106802914308 Mon Sep 17 00:00:00 2001 From: jsyang <mind-one003@mind-one.co.kr> Date: Thu, 28 Aug 2025 09:34:47 +0900 Subject: [PATCH 23/35] =?UTF-8?q?=EA=B3=84=ED=9A=8D=ED=95=98=EC=88=98?= =?UTF-8?q?=EB=9F=89=20=EC=82=B0=EC=A0=95=EC=A7=80=ED=91=9C=ED=98=84?= =?UTF-8?q?=ED=99=A9=20-=20=ED=95=84=EC=9A=94=EC=97=86=EB=8A=94=20?= =?UTF-8?q?=EC=BD=98=EC=86=94=EC=A0=9C=EA=B1=B0=20-=20=EB=B3=80=EB=8F=99?= =?UTF-8?q?=EB=B6=80=ED=95=98=EC=9C=A8=20=EA=B3=84=EC=82=B0=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/(with-layout)/planSewage/page.tsx | 1 - apps/fo/app/store/planSewage/index.tsx | 23 ++++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/apps/fo/app/pages/(with-layout)/planSewage/page.tsx b/apps/fo/app/pages/(with-layout)/planSewage/page.tsx index b39a3e8df..634b0507d 100644 --- a/apps/fo/app/pages/(with-layout)/planSewage/page.tsx +++ b/apps/fo/app/pages/(with-layout)/planSewage/page.tsx @@ -107,7 +107,6 @@ export default function PlanSewage() { }, [isInit, initializeCommonData, searchPlanSewageList]); useEffect(() => { - console.log('excelList' , excelList); if (excelList && excelList.length > 0) { downloadExcel({ data: excelList as unknown as JSON[], diff --git a/apps/fo/app/store/planSewage/index.tsx b/apps/fo/app/store/planSewage/index.tsx index ccf6c9d73..25bbc9147 100644 --- a/apps/fo/app/store/planSewage/index.tsx +++ b/apps/fo/app/store/planSewage/index.tsx @@ -3,6 +3,7 @@ import type { TableUpperProps } from "../dashboard"; import { getFetch } from "@/app/components/api"; import { type ApiResponse, type FlowDataItem } from "../underWaterInput"; import CalcRainEffect from "@/app/components/common/CalcRainEffect"; +import { roundUp } from "../common"; export type { TableUpperProps }; /**==================================== * Store - 타입 @@ -95,7 +96,6 @@ const planSewageList:PlanSewageProps[] = [ 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; - console.log(url); const res = await getFetch('fo', url); return { data: res.data, count: res.count } } @@ -183,22 +183,25 @@ export const planSewageReducer:(set:(fn: (state: PlanSewageType) => PlanSewageTy const data = res.data const processedData = await Promise.all(data.map(async (item:PlanSewageProps) => { const res2 = await getFetch('fo', '/fclt/flow/' + item.bscFctCd + '/' + searchYear) as ApiResponse; - const calData = CalcRainEffect(res2.data, 'SUNNY'); + const calData = CalcRainEffect(res2.data, 'SUNNY', 'RAIN_DAY'); let sumInflAmntSunny = 0; let avgInflAmntSunny = 0; + let maxInflAmntSunny = 0; calData.forEach((flowItem:FlowDataItem) => { sumInflAmntSunny += Number(flowItem.inflAmnt); - }) + + if(Number(flowItem.inflAmnt) > maxInflAmntSunny){ + maxInflAmntSunny = Number(flowItem.inflAmnt); + } + }); + avgInflAmntSunny = sumInflAmntSunny / calData.length; - item.avgInflAmntSunny = avgInflAmntSunny; - if(item.bscFctCd === '11200PB001R'){ - console.log('avgInflAmntSunny : ',item.avgInflAmntSunny); - console.log('calData : ',calData); - } + item.avgInflAmntSunny = roundUp(avgInflAmntSunny, 0); + item.maxInflAmntSunny = roundUp(maxInflAmntSunny, 0); return item; })); - + /** * 결과데이터 계산 * (1) 여유용량 = 시설용량 - 건기시 평균유량 @@ -206,8 +209,6 @@ export const planSewageReducer:(set:(fn: (state: PlanSewageType) => PlanSewageTy * (3) 분류식화율 = 분류식지역 면적(㎢)/처리구역 면적합계(㎢) ×100 */ const resultData = processedData.map((item:PlanSewageProps) => { - console.log('item.fctCpc : ',item.fctCpc); - console.log('item.avgInflAmntSunny : ',item.avgInflAmntSunny); item.spareCapacity = Number(item.fctCpc) - Number(item.avgInflAmntSunny); item.variableLoadPercent = item.maxInflAmntSunny && item.maxInflAmntSunny!==0 ? Number(item.maxInflAmntSunny) / Number(item.avgInflAmntSunny) : 0; item.classifiedSewerPercent = item.sprtProcZoneAr && item.sprtProcZoneAr!==0 ? Number(item.sprtProcZoneAr) / Number(item.procZoneSm) * 100 : 0; From a2a38f8937651bba63bd36c21514c2e058b75911 Mon Sep 17 00:00:00 2001 From: jsyang <mind-one003@mind-one.co.kr> Date: Thu, 28 Aug 2025 10:53:31 +0900 Subject: [PATCH 24/35] =?UTF-8?q?=EA=B0=95=EC=9A=B0=EC=98=81=ED=96=A5?= =?UTF-8?q?=EC=9D=BC=20=EB=A1=9C=EC=A7=81=EC=88=98=EC=A0=95=20-=20changePa?= =?UTF-8?q?rt=20=EC=A0=9C=EA=B1=B0=20-=20=EA=B0=95=EC=9A=B0=EC=98=81?= =?UTF-8?q?=ED=96=A5=EC=9D=BC=20=EA=B3=84=EC=82=B0=20=ED=9B=84=20=EA=B0=95?= =?UTF-8?q?=EC=9A=B0=EC=9D=BC=20=EB=8B=B4=EC=9D=80=20toBeInfoRnDay=20?= =?UTF-8?q?=EB=B3=80=EC=88=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/components/common/CalcRainEffect.tsx | 47 +++++++++---------- .../common/FacilityTermModalHeader.tsx | 14 +++--- .../facilityPrecipitation/modal/page.tsx | 2 +- .../pages/(with-layout)/planSewage/page.tsx | 2 +- apps/fo/app/store/dashboard/index.tsx | 8 ++-- apps/fo/app/store/flowRate/index.tsx | 2 +- apps/fo/app/store/planSewage/index.tsx | 2 +- 7 files changed, 37 insertions(+), 40 deletions(-) diff --git a/apps/fo/app/components/common/CalcRainEffect.tsx b/apps/fo/app/components/common/CalcRainEffect.tsx index bd6e39185..c35140d83 100644 --- a/apps/fo/app/components/common/CalcRainEffect.tsx +++ b/apps/fo/app/components/common/CalcRainEffect.tsx @@ -6,11 +6,10 @@ * 2.강우영향일이면서 3mm이하의 강우량일 경우에는 강우영향을 준 날의 강우량을 따름 * @param data * @param weather (default:ALL), SUNNY, ..etc - * @param chagePart (default:ALL), RAIN_DAY, RAIN_AMNT * @author jsyang */ -export default function CalcRainEffect(data : any, weather='ALL', changePart='ALL') { +export default function CalcRainEffect(data : any, weather='ALL') { console.log("%c Calculate RainEffect !" , "background:blue;color:white"); console.log("%c Data Length :"+data.length+" Weather : "+weather , "background:yellow;color:blue"); // 강우영향일 계산 (강우량이 3 초과이면 무조건 강우영향일) @@ -25,40 +24,38 @@ export default function CalcRainEffect(data : any, weather='ALL', changePart='AL if(item.infoRnDay == 'x'){ item.infoRnDay = '0.0'; + item.toBeInfoRnDay = '0.0'; }else{ item.infoRnDay = Number(item.infoRnDay).toFixed(1); + item.toBeInfoRnDay = Number(item.infoRnDay).toFixed(1); } } } - if(['ALL', 'RAIN_DAY'].includes(changePart)) { - // 이틀 전, 하루 전이 강우영향일(3 이상)인 경우 해당 날도 강우영향일로 설정 - for(let idx = 0; idx < data.length; idx++) { - if(data[idx]) { - // 하루 전이 강우영향일(3 이상)인 경우 - if(idx > 0 && data[idx-1]?.infoRnDay && Number(data[idx-1]?.infoRnDay) >= 3) { - data[idx]!.rainEffectDay = 1; - } - // 이틀 전이 강우영향일(3 이상)인 경우 - if(idx > 1 && data[idx-2]?.infoRnDay && Number(data[idx-2]?.infoRnDay) >= 3) { - data[idx]!.rainEffectDay = 1; - } + // 이틀 전, 하루 전이 강우영향일(3 이상)인 경우 해당 날도 강우영향일로 설정 + for(let idx = 0; idx < data.length; idx++) { + if(data[idx]) { + // 하루 전이 강우영향일(3 이상)인 경우 + if(idx > 0 && data[idx-1]?.infoRnDay && Number(data[idx-1]?.infoRnDay) >= 3) { + data[idx]!.rainEffectDay = 1; + } + // 이틀 전이 강우영향일(3 이상)인 경우 + if(idx > 1 && data[idx-2]?.infoRnDay && Number(data[idx-2]?.infoRnDay) >= 3) { + data[idx]!.rainEffectDay = 1; } } } - if(['ALL', 'RAIN_AMNT'].includes(changePart)){ - for(let idx = 0; idx < data.length; idx++) { - if(data[idx] && data[idx]?.rainEffectDay === 1) { - if(idx > 1){ - if(data[idx-1]?.infoRnDay && Number(data[idx]?.infoRnDay) < 3 && Number(data[idx-1]?.infoRnDay.toString().trim()) >= 3) { - data[idx]!.infoRnDay = data[idx-1]!.infoRnDay; - } + for(let idx = 0; idx < data.length; idx++) { + if(data[idx] && data[idx]?.rainEffectDay === 1) { + if(idx > 1){ + if(data[idx-1]?.infoRnDay && Number(data[idx]?.infoRnDay) < 3 && Number(data[idx-1]?.infoRnDay.toString().trim()) >= 3) { + data[idx]!.toBeInfoRnDay = data[idx-1]!.infoRnDay; } - if(idx > 2){ - if(data[idx-2]?.infoRnDay && Number(data[idx]?.infoRnDay) < 3 && Number(data[idx-2]?.infoRnDay.toString().trim()) >= 3) { - data[idx]!.infoRnDay = data[idx-2]!.infoRnDay; - } + } + if(idx > 2){ + if(data[idx-2]?.infoRnDay && Number(data[idx]?.infoRnDay) < 3 && Number(data[idx-2]?.infoRnDay.toString().trim()) >= 3) { + data[idx]!.toBeInfoRnDay = data[idx-2]!.infoRnDay; } } } diff --git a/apps/fo/app/components/common/FacilityTermModalHeader.tsx b/apps/fo/app/components/common/FacilityTermModalHeader.tsx index d856e233f..a11323528 100644 --- a/apps/fo/app/components/common/FacilityTermModalHeader.tsx +++ b/apps/fo/app/components/common/FacilityTermModalHeader.tsx @@ -98,25 +98,25 @@ export default function FacilityTermModalHeader<T extends { msrDt: string }>({ const endDateOnly = new Date(endDate.getFullYear(), endDate.getMonth(), endDate.getDate()); const rainEffectDay = (item as T & { rainEffectDay: number }).rainEffectDay; if(flowPanel === '2'){ - const infoRnDay = (item as T & { infoRnDay: number }).infoRnDay; + const infoRnDay = (item as T & { toBeInfoRnDay: number }).toBeInfoRnDay; return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && infoRnDay >= 3 && infoRnDay < 10; } else if(flowPanel === '3'){ - const infoRnDay = (item as T & { infoRnDay: number }).infoRnDay; + const infoRnDay = (item as T & { toBeInfoRnDay: number }).toBeInfoRnDay; return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && infoRnDay >= 10 && infoRnDay < 20; } else if(flowPanel === '4'){ - const infoRnDay = (item as T & { infoRnDay: number }).infoRnDay; + const infoRnDay = (item as T & { toBeInfoRnDay: number }).toBeInfoRnDay; return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && infoRnDay >= 20 && infoRnDay < 30; } else if(flowPanel === '5'){ - const infoRnDay = (item as T & { infoRnDay: number }).infoRnDay; + const infoRnDay = (item as T & { toBeInfoRnDay: number }).toBeInfoRnDay; return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && infoRnDay >= 30 && infoRnDay < 40; } else if(flowPanel === '6'){ - const infoRnDay = (item as T & { infoRnDay: number }).infoRnDay; + const infoRnDay = (item as T & { toBeInfoRnDay: number }).toBeInfoRnDay; return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && infoRnDay >= 40 && infoRnDay < 50; } else if(flowPanel === '7'){ - const infoRnDay = (item as T & { infoRnDay: number }).infoRnDay; + const infoRnDay = (item as T & { toBeInfoRnDay: number }).toBeInfoRnDay; return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && infoRnDay >= 50 && infoRnDay < 60; } else if(flowPanel === '8'){ - const infoRnDay = (item as T & { infoRnDay: number }).infoRnDay; + const infoRnDay = (item as T & { toBeInfoRnDay: number }).toBeInfoRnDay; return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && infoRnDay >= 60; } else { return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && (rainEffectDay ===1); diff --git a/apps/fo/app/pages/(with-layout)/facilityPrecipitation/modal/page.tsx b/apps/fo/app/pages/(with-layout)/facilityPrecipitation/modal/page.tsx index e7659f672..0b4ef5830 100644 --- a/apps/fo/app/pages/(with-layout)/facilityPrecipitation/modal/page.tsx +++ b/apps/fo/app/pages/(with-layout)/facilityPrecipitation/modal/page.tsx @@ -122,7 +122,7 @@ export default function PrecipitationModal(props: PrecipitationModalProps) { const filteredList = props.detailList .map(i => ({ ...i })) // ← 얕은 복제 .filter((item) => props.facilityCd === item.bscFctCd); - const calcData = CalcRainEffect(filteredList, 'ALL', 'RAIN_DAY'); + const calcData = CalcRainEffect(filteredList); setFilteredDetailList(calcData); setCopyDetailList(calcData); diff --git a/apps/fo/app/pages/(with-layout)/planSewage/page.tsx b/apps/fo/app/pages/(with-layout)/planSewage/page.tsx index 634b0507d..00539da13 100644 --- a/apps/fo/app/pages/(with-layout)/planSewage/page.tsx +++ b/apps/fo/app/pages/(with-layout)/planSewage/page.tsx @@ -104,7 +104,7 @@ export default function PlanSewage() { initializeCommonData(); searchPlanSewageList(1, 10, selectSearchYear[0]?.val || "0", ref.current.partValue); } - }, [isInit, initializeCommonData, searchPlanSewageList]); + }, [isInit, initializeCommonData, searchPlanSewageList, selectSearchYear]); useEffect(() => { if (excelList && excelList.length > 0) { diff --git a/apps/fo/app/store/dashboard/index.tsx b/apps/fo/app/store/dashboard/index.tsx index 64cef9723..016084a00 100644 --- a/apps/fo/app/store/dashboard/index.tsx +++ b/apps/fo/app/store/dashboard/index.tsx @@ -745,8 +745,8 @@ const calcWaterQltyData = async (data: any[], searchYear : string|undefined, fcl if(res.data.wqltObjs.length> 0) { const clone = (arr: any[]) => arr?.map(v => ({ ...v })) ?? []; const qltyData = res.data.wqltObjs; - const qltyChungchunData = CalcRainEffect(clone(qltyData), 'SUNNY', 'RAIN_DAY'); - const qltyRainData = CalcRainEffect(clone(qltyData), 'RAIN', 'RAIN_DAY'); + const qltyChungchunData = CalcRainEffect(clone(qltyData), 'SUNNY'); + const qltyRainData = CalcRainEffect(clone(qltyData), 'RAIN'); // (0) 전체변수 let summerDay = 0; @@ -1507,7 +1507,7 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) const clone = (arr: any[]) => arr?.map(v => ({ ...v })) ?? []; const calData = CalcRainEffect(clone(res2.data), 'SUNNY'); - const calRainDate = CalcRainEffect(clone(res2.data), 'RAIN', 'RAIN_DAY'); + const calRainDate = CalcRainEffect(clone(res2.data), 'RAIN'); // 지하수유입량 - 청천시 기준 let chungcunSumFlow = 0; @@ -1958,7 +1958,7 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) // 청천시 중 강우영향일인 날짜는 이전의 강우량을 대입해 리스트 수정 - const rainEffectList = CalcRainEffect(res.data.wqltObjs); + const rainEffectList = CalcRainEffect(res.data.wqltObjs, 'RAIN_DAY'); // Process the data and create rain management list const totItemCnt = rainEffectList?rainEffectList.length : 1; diff --git a/apps/fo/app/store/flowRate/index.tsx b/apps/fo/app/store/flowRate/index.tsx index a6580500d..c73bcc0cd 100644 --- a/apps/fo/app/store/flowRate/index.tsx +++ b/apps/fo/app/store/flowRate/index.tsx @@ -320,7 +320,7 @@ export const flowRateSearchReducer:(set:(fn: (state: FlowRateSearchType) => Flow searchFlowRateModalList: async (bscFctCd: string, searchYear: string) => { const res = await fetchFlowRateModalList(bscFctCd, searchYear); const data = CalcRainEffect(res.data); - + console.log(data); const rtnData = data.map((item: FlowRateModalProps) => { item.totInflAmnt = Number(item.inflAmnt || 0) + Number(item.sumFlow || 0) + Number(item.returnAmnt || 0) dataFormSetting(item); diff --git a/apps/fo/app/store/planSewage/index.tsx b/apps/fo/app/store/planSewage/index.tsx index 25bbc9147..21a711e8b 100644 --- a/apps/fo/app/store/planSewage/index.tsx +++ b/apps/fo/app/store/planSewage/index.tsx @@ -183,7 +183,7 @@ export const planSewageReducer:(set:(fn: (state: PlanSewageType) => PlanSewageTy const data = res.data const processedData = await Promise.all(data.map(async (item:PlanSewageProps) => { const res2 = await getFetch('fo', '/fclt/flow/' + item.bscFctCd + '/' + searchYear) as ApiResponse; - const calData = CalcRainEffect(res2.data, 'SUNNY', 'RAIN_DAY'); + const calData = CalcRainEffect(res2.data, 'SUNNY'); let sumInflAmntSunny = 0; let avgInflAmntSunny = 0; From 155f34591121789beb79a1c33b0b22c8455b3f0f Mon Sep 17 00:00:00 2001 From: jsyang <mind-one003@mind-one.co.kr> Date: Thu, 28 Aug 2025 14:13:04 +0900 Subject: [PATCH 25/35] =?UTF-8?q?=EA=B0=95=EC=9A=B0=EC=9D=BC=20=EC=9A=B4?= =?UTF-8?q?=EC=98=81=ED=98=84=ED=99=A9=20toBeInfoRnDay=EA=B0=80=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=EB=90=A8=EC=97=90=20=EB=94=B0=EB=A5=B8=20?= =?UTF-8?q?=EB=A1=9C=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/FacilityTermModalHeader.tsx | 1 + apps/fo/app/store/dashboard/index.tsx | 17 ++++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/apps/fo/app/components/common/FacilityTermModalHeader.tsx b/apps/fo/app/components/common/FacilityTermModalHeader.tsx index a11323528..52cee2ea3 100644 --- a/apps/fo/app/components/common/FacilityTermModalHeader.tsx +++ b/apps/fo/app/components/common/FacilityTermModalHeader.tsx @@ -97,6 +97,7 @@ export default function FacilityTermModalHeader<T extends { msrDt: string }>({ const startDateOnly = new Date(startDate.getFullYear(), startDate.getMonth(), startDate.getDate()); const endDateOnly = new Date(endDate.getFullYear(), endDate.getMonth(), endDate.getDate()); const rainEffectDay = (item as T & { rainEffectDay: number }).rainEffectDay; + if(flowPanel === '2'){ const infoRnDay = (item as T & { toBeInfoRnDay: number }).toBeInfoRnDay; return (itemDateOnly >= startDateOnly && itemDateOnly <= endDateOnly) && infoRnDay >= 3 && infoRnDay < 10; diff --git a/apps/fo/app/store/dashboard/index.tsx b/apps/fo/app/store/dashboard/index.tsx index 016084a00..5000492c0 100644 --- a/apps/fo/app/store/dashboard/index.tsx +++ b/apps/fo/app/store/dashboard/index.tsx @@ -147,6 +147,7 @@ export interface RainManageListProps { dsInflWqltTp: number | '', extnsSeqno?: number | '', rainEffectDay?: number | '', + toBeInfoRnDay? : number | '', } export interface RainManageExcelType { @@ -1985,7 +1986,9 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) totEfflWqltTn += item.efflWqltTn ? Number(item.efflWqltTn.toString().trim()) : 0; totEfflWqltTp += item.efflWqltTp ? Number(item.efflWqltTp.toString().trim()) : 0; - if(Number(item.infoRnDay) >= 3 && Number(item.infoRnDay) < 10){ + const toBeRain = item.toBeInfoRnDay ? Number(item.toBeInfoRnDay) : 0; + + if(toBeRain >= 3 && toBeRain < 10){ rainDate[1] = Number(rainDate[1] || 0) + 1; inflAmtCnt[1] = Number(inflAmtCnt[1] || 0) + 1; inflAmnt[1] = Number(inflAmnt[1] || 0) + Number(item.inflAmnt || 0); @@ -2010,7 +2013,7 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) efflWqltTn[1] = Number(efflWqltTn[1] || 0) + Number(item.efflWqltTn || 0); efflWqltTpCnt[1] = Number(efflWqltTpCnt[1] || 0) + 1; efflWqltTp[1] = Number(efflWqltTp[1] || 0) + Number(item.efflWqltTp || 0); - }else if(Number(item.infoRnDay) >= 10 && Number(item.infoRnDay) < 20){ + }else if(toBeRain >= 10 && toBeRain < 20){ rainDate[2] = Number(rainDate[2] || 0) + 1; inflAmtCnt[2] = Number(inflAmtCnt[2] || 0) + 1; inflAmnt[2] = Number(inflAmnt[2] || 0) + Number(item.inflAmnt || 0); @@ -2035,7 +2038,7 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) efflWqltTn[2] = Number(efflWqltTn[2] || 0) + Number(item.efflWqltTn || 0); efflWqltTpCnt[2] = Number(efflWqltTpCnt[2] || 0) + 1; efflWqltTp[2] = Number(efflWqltTp[2] || 0) + Number(item.efflWqltTp || 0); - }else if(Number(item.infoRnDay) >= 20 && Number(item.infoRnDay) < 30){ + }else if(toBeRain >= 20 && toBeRain < 30){ rainDate[3] = Number(rainDate[3] || 0) + 1; inflAmtCnt[3] = Number(inflAmtCnt[3] || 0) + 1; inflAmnt[3] = Number(inflAmnt[3] || 0) + Number(item.inflAmnt || 0); @@ -2060,7 +2063,7 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) efflWqltTn[3] = Number(efflWqltTn[3] || 0) + Number(item.efflWqltTn || 0); efflWqltTpCnt[3] = Number(efflWqltTpCnt[3] || 0) + 1; efflWqltTp[3] = Number(efflWqltTp[3] || 0) + Number(item.efflWqltTp || 0); - }else if(Number(item.infoRnDay) >= 30 && Number(item.infoRnDay) < 40){ + }else if(toBeRain >= 30 && toBeRain < 40){ rainDate[4] = Number(rainDate[4] || 0) + 1; inflAmtCnt[4] = Number(inflAmtCnt[4] || 0) + 1; inflAmnt[4] = Number(inflAmnt[4] || 0) + Number(item.inflAmnt || 0); @@ -2085,7 +2088,7 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) efflWqltTn[4] = Number(efflWqltTn[4] || 0) + Number(item.efflWqltTn || 0); efflWqltTpCnt[4] = Number(efflWqltTpCnt[4] || 0) + 1; efflWqltTp[4] = Number(efflWqltTp[4] || 0) + Number(item.efflWqltTp || 0); - }else if(Number(item.infoRnDay) >= 40 && Number(item.infoRnDay) < 50){ + }else if(toBeRain >= 40 && toBeRain < 50){ rainDate[5] = Number(rainDate[5] || 0) + 1; inflAmtCnt[5] = Number(inflAmtCnt[5] || 0) + 1; inflAmnt[5] = Number(inflAmnt[5] || 0) + Number(item.inflAmnt || 0); @@ -2110,7 +2113,7 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) efflWqltTn[5] = Number(efflWqltTn[5] || 0) + Number(item.efflWqltTn || 0); efflWqltTpCnt[5] = Number(efflWqltTpCnt[5] || 0) + 1; efflWqltTp[5] = Number(efflWqltTp[5] || 0) + Number(item.efflWqltTp || 0); - }else if(Number(item.infoRnDay) >= 50 && Number(item.infoRnDay) < 60){ + }else if(toBeRain >= 50 && toBeRain < 60){ rainDate[6] = Number(rainDate[6] || 0) + 1; inflAmtCnt[6] = Number(inflAmtCnt[6] || 0) + 1; inflAmnt[6] = Number(inflAmnt[6] || 0) + Number(item.inflAmnt || 0); @@ -2135,7 +2138,7 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) efflWqltTn[6] = Number(efflWqltTn[6] || 0) + Number(item.efflWqltTn || 0); efflWqltTpCnt[6] = Number(efflWqltTpCnt[6] || 0) + 1; efflWqltTp[6] = Number(efflWqltTp[6] || 0) + Number(item.efflWqltTp || 0); - }else if(Number(item.infoRnDay) >= 60){ + }else if(toBeRain >= 60){ rainDate[7] = Number(rainDate[7] || 0) + 1; inflAmtCnt[7] = Number(inflAmtCnt[7] || 0) + 1; inflAmnt[7] = Number(inflAmnt[7] || 0) + Number(item.inflAmnt || 0); From ebe7d1a86c7a7c5a4380cf445701b1a41edc70cb Mon Sep 17 00:00:00 2001 From: jsyang <mind-one003@mind-one.co.kr> Date: Fri, 29 Aug 2025 14:55:55 +0900 Subject: [PATCH 26/35] =?UTF-8?q?=EC=A3=BC=EC=9A=94=EA=B7=B8=EB=9E=98?= =?UTF-8?q?=ED=94=84=20=EC=B4=9D=EC=9D=B8=EC=9C=A0=EC=9E=85tp=200=EC=9D=B4?= =?UTF-8?q?=EB=82=98=20null=EC=9D=B8=20=EA=B2=BD=EC=9A=B0=20=EC=95=88?= =?UTF-8?q?=EB=B3=B4=EC=97=AC=EC=A7=80=EB=8F=84=EB=A1=9D=20=EC=88=98?= =?UTF-8?q?=EC=A0=95(0=EC=9C=BC=EB=A1=9C=20=EC=95=88=EB=82=98=EC=98=A4?= =?UTF-8?q?=EB=8F=84=EB=A1=9D..)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/(with-layout)/dashboard/page.tsx | 19 ++++++++++--------- apps/fo/app/store/dashboard/index.tsx | 4 ++-- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/apps/fo/app/pages/(with-layout)/dashboard/page.tsx b/apps/fo/app/pages/(with-layout)/dashboard/page.tsx index 167df2a7b..df41340e4 100644 --- a/apps/fo/app/pages/(with-layout)/dashboard/page.tsx +++ b/apps/fo/app/pages/(with-layout)/dashboard/page.tsx @@ -9,6 +9,7 @@ import ProcessFacilitySearch from "./facilityInfo/page"; import DashBoardChart from "./maingraph/page"; import RainManageTab from "./rainManage/page"; import DrainageEquipment from "./drainageEquipment/page"; +import { roundNumber } from "@/app/components/common/DataForm"; const tabList = [ { value: 'facilityInfo', label: '시설정보 및 운영현황' }, @@ -193,55 +194,55 @@ export default function DashBoard() { const sheetParameter = [ { - data: [['날짜', '강수량'],...chart_inflowRain.map((item) => [item.label, item.barVal0])], + data: [['날짜', '강수량'],...chart_inflowRain.map((item) => [item.label, roundNumber(item.barVal0, 1)])], headerNum: 1, headerRange: 'A1:B1', sheetName: '강수량' }, { - data: [['날짜', '유입하수량'],...chart_inflowRain.map((item) => [item.label, item.lineVal1])], + data: [['날짜', '유입하수량'],...chart_inflowRain.map((item) => [item.label, roundNumber(item.lineVal1, 0)])], headerNum: 1, headerRange: 'A1:B1', sheetName: '유입하수량' }, { - data: [['날짜', '시설용량'],...chart_inflowRain.map((item) => [item.label, item.lineVal0])], + data: [['날짜', '시설용량'],...chart_inflowRain.map((item) => [item.label, roundNumber(item.lineVal0, 0)])], headerNum: 1, headerRange: 'A1:B1', sheetName: '시설용량' }, { - data: [['날짜', '유입BOD'],...chart_bodRain.map((item) => [item.label, item.lineVal0])], + data: [['날짜', '유입BOD'],...chart_bodRain.map((item) => [item.label, roundNumber(item.lineVal0, 1)])], headerNum: 1, headerRange: 'A1:B1', sheetName: '유입BOD' }, { - data: [['날짜', '유입T-P'],...chart_inflTp.map((item) => [item.label, item.val])], + data: [['날짜', '유입T-P'],...chart_inflTp.map((item) => [item.label, roundNumber(item.val, 3)])], headerNum: 1, headerRange: 'A1:B1', sheetName: '유입T-P' }, { - data: [['날짜', '총인유입T-P'],...chart_chongInTp.map((item) => [item.label, item.val])], + data: [['날짜', '총인유입T-P'],...chart_chongInTp.map((item) => [item.label, roundNumber(item.val, 3)])], headerNum: 1, headerRange: 'A1:B1', sheetName: '총인유입T-P' }, { - data: [['날짜', '방류T-P'],...chart_efflTp.map((item) => [item.label, item.val])], + data: [['날짜', '방류T-P'],...chart_efflTp.map((item) => [item.label, roundNumber(item.val, 3)])], headerNum: 1, headerRange: 'A1:B1', sheetName: '방류T-P' }, { - data: [['날짜', '유입T-N'],...chart_inflTn.map((item) => [item.label, item.val])], + data: [['날짜', '유입T-N'],...chart_inflTn.map((item) => [item.label, roundNumber(item.val, 3)])], headerNum: 1, headerRange: 'A1:B1', sheetName: '유입T-N' }, { - data: [['날짜', '방류T-N'],...chart_efflTn.map((item) => [item.label, item.val])], + data: [['날짜', '방류T-N'],...chart_efflTn.map((item) => [item.label, roundNumber(item.val, 3)])], headerNum: 1, headerRange: 'A1:B1', sheetName: '방류T-N' diff --git a/apps/fo/app/store/dashboard/index.tsx b/apps/fo/app/store/dashboard/index.tsx index 5000492c0..11a215a1d 100644 --- a/apps/fo/app/store/dashboard/index.tsx +++ b/apps/fo/app/store/dashboard/index.tsx @@ -1854,10 +1854,10 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) label: item.msrDt.substring(0, 4)+"-"+item.msrDt.substring(4, 6)+"-"+item.msrDt.substring(6, 8), val : item.inflAssctBfrWqltTp ?? 0 })); - + const chart_chongInTp = res.data.wqltObjs.map((item: FacilityWaterQltyProps) => ({ label: item.msrDt.substring(0, 4)+"-"+item.msrDt.substring(4, 6)+"-"+item.msrDt.substring(6, 8), - val : item.tpInflWqltTp ?? 0 + val : Number(item.tpInflWqltTp) == 0 ? null : item.tpInflWqltTp })); const chart_efflTp = res.data.wqltObjs.map((item: FacilityWaterQltyProps) => ({ From 03dd39b128a50a3ca9528b608e61752b06ed8cef Mon Sep 17 00:00:00 2001 From: jsyang <mind-one003@mind-one.co.kr> Date: Fri, 29 Aug 2025 15:32:02 +0900 Subject: [PATCH 27/35] =?UTF-8?q?=EC=9A=B4=EC=98=81=ED=98=95=EC=83=81?= =?UTF-8?q?=EC=97=90=20=EB=A7=9E=EC=B6=B0=EC=84=9C=20=EC=84=B8=ED=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/fo/.env.production | 37 ++++++++++++++++--------------- apps/fo/middleware.ts | 49 ++++++++++++++++++++++++++++++++++++----- 2 files changed, 62 insertions(+), 24 deletions(-) diff --git a/apps/fo/.env.production b/apps/fo/.env.production index 797328765..a1da344b8 100644 --- a/apps/fo/.env.production +++ b/apps/fo/.env.production @@ -1,31 +1,32 @@ -# NEXT_PUBLIC_SITE_ID = WR -# NEXT_PUBLIC_PORT = 11301 -# NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11301 -# NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000 +# NEXT_PUBLIC_SITE_ID = FO +# NEXT_PUBLIC_PORT = 11300 +# NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11300 +# NEXT_PUBLIC_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1 +# #NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000 +# NEXT_PUBLIC_WR_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1 +# NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000 # NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver # NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver # NEXT_PUBLIC_CLAIM_NAME = Authorization # NEXT_PUBLIC_AUTH_USER_ID = token-id # NEXT_PUBLIC_ACCESS_TOKEN = access-token # NEXT_PUBLIC_REFRESH_TOKEN = refresh-token - - +# NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API NEXT_PUBLIC_SITE_ID = FO -NEXT_PUBLIC_PORT = 11300 -NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11300 -NEXT_PUBLIC_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1 -#NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000 -NEXT_PUBLIC_WR_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1 -NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000 -#NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver -NEXT_PUBLIC_GEOSERVER_URL = https://hasudo.geo.rsonesoft.com/geoserver -NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver +NEXT_PUBLIC_PORT = 3000 +NEXT_PUBLIC_PROXY_HOST = https://fo.hasuon.or.kr +# NEXT_PUBLIC_SERVER_API_URL = http://apigateway.iipbs-dev.svc.cluster.local:8000 +NEXT_PUBLIC_SERVER_API_URL = https://fo.hasuon.or.kr/operation-service/api/v1 +NEXT_PUBLIC_FO_SERVER_API_URL = https://apigateway.hasuon.or.kr/operation-service/api/v1 +NEXT_PUBLIC_CS_SERVER_API_URL = http://apigateway.iipbs-dev.svc.cluster.local:8000 +NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload +NEXT_PUBLIC_GEOSERVER_URL = http://172.29.143.87:8080/geoserver +NEXT_PUBLIC_LX_GEOSERVER_URL = http://172.29.143.87:8080/geoserver_swl NEXT_PUBLIC_CLAIM_NAME = Authorization NEXT_PUBLIC_AUTH_USER_ID = token-id NEXT_PUBLIC_ACCESS_TOKEN = access-token NEXT_PUBLIC_REFRESH_TOKEN = refresh-token -NEXT_PUBLIC_NGII_URL = http://10.98.25.94:18080/openapi/Gettile.do?apiKey=BDE2BEF39DAFEC293AB6730150F222AC -NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API - +NEXT_PUBLIC_WR_SERVER_API_URL = https://fo.hasuon.or.kr/reuse-service/api/v1 +NEXT_PUBLIC_SEWERAGE_API_URL = https://fo.hasuon.or.kr/sewerage-service/api \ No newline at end of file diff --git a/apps/fo/middleware.ts b/apps/fo/middleware.ts index 317c6a706..32257341d 100644 --- a/apps/fo/middleware.ts +++ b/apps/fo/middleware.ts @@ -6,7 +6,7 @@ const CLAIM_NAME = process.env.NEXT_PUBLIC_CLAIM_NAME || "Authorization"; const GEOSERVER_URL = process.env.NEXT_PUBLIC_GEOSERVER_URL || ""; const LX_GEOSERVER_URL = process.env.NEXT_PUBLIC_LX_GEOSERVER_URL || ""; const SEWERAGE_API_URL = process.env.NEXT_PUBLIC_SEWERAGE_API_URL || ""; - +const serverApiUrl = SERVER_API_CS_URL; export function middleware(req: NextRequest) { console.log("Middleware 진입:", req.nextUrl.pathname); const pathname = req.nextUrl.pathname; @@ -14,7 +14,7 @@ export function middleware(req: NextRequest) { if (pathname.startsWith("/server")) { const queryParams = searchParams.toString(); - const newUrl = `${SERVER_API_CS_URL}${pathname.replace("/server", "")}${ + const newUrl = `${serverApiUrl}${pathname.replace("/server", "")}${ queryParams ? `?${queryParams}` : "" }`; console.log(`[Middleware] Rewriting from '/server' path to: ${newUrl}`); @@ -76,13 +76,47 @@ export function middleware(req: NextRequest) { const requestHeaders = new Headers(req.headers); const token = req.cookies.get(CLAIM_NAME)?.value; const userId = req.cookies.get(AUTH_USER_ID)?.value; - const newUrl = `${SERVER_API_CS_URL}${pathname}`; + const newUrl = `${serverApiUrl}${pathname}`; if (token) requestHeaders.set(CLAIM_NAME, token); if (userId) requestHeaders.set(AUTH_USER_ID, userId); console.log( - `[Middleware] Rewriting from '/attach-service' path to: ${newUrl}`, + `[Middleware] Rewriting from '/attach-service' path to: ${newUrl}` + ); + return NextResponse.rewrite(new URL(newUrl), { + headers: requestHeaders, + }); + } + + if (pathname.startsWith("/operation-service")) { + const requestHeaders = new Headers(req.headers); + const token = req.cookies.get(CLAIM_NAME)?.value; + const userId = req.cookies.get(AUTH_USER_ID)?.value; + const newUrl = `${serverApiUrl}${pathname}`; + + if (token) requestHeaders.set(CLAIM_NAME, token); + if (userId) requestHeaders.set(AUTH_USER_ID, userId); + + console.log( + `[Middleware] Rewriting from '/operation-service' path to: ${newUrl}` + ); + return NextResponse.rewrite(new URL(newUrl), { + headers: requestHeaders, + }); + } + + if (pathname.startsWith("/reuse-service")) { + const requestHeaders = new Headers(req.headers); + const token = req.cookies.get(CLAIM_NAME)?.value; + const userId = req.cookies.get(AUTH_USER_ID)?.value; + const newUrl = `${serverApiUrl}${pathname}`; + + if (token) requestHeaders.set(CLAIM_NAME, token); + if (userId) requestHeaders.set(AUTH_USER_ID, userId); + + console.log( + `[Middleware] Rewriting from '/reuse-service' path to: ${newUrl}` ); return NextResponse.rewrite(new URL(newUrl), { headers: requestHeaders, @@ -94,12 +128,13 @@ export function middleware(req: NextRequest) { const newUrl = `${SERVER_API_CS_URL}${pathname}`; console.log( - `[Middleware] Rewriting from '/user-service' path to: ${newUrl}`, + `[Middleware] Rewriting from '/user-service' path to: ${newUrl}` ); return NextResponse.rewrite(new URL(newUrl), { headers: requestHeaders, }); } + if (pathname === "/") { return NextResponse.redirect(new URL("/pages/dashboard", req.url)); } @@ -108,11 +143,13 @@ export function middleware(req: NextRequest) { export const config = { matcher: [ + "/", "/server/:path*", "/geoserver/:path*", "/attach-service/:path*", "/user-service/:path*", "/cms-service/:path*", - "/" + "/operation-service/:path*", + "/reuse-service/:path*", ], }; From e434e711bfc155e26368c5d890aae739b656f5e9 Mon Sep 17 00:00:00 2001 From: jsyang <mind-one003@mind-one.co.kr> Date: Mon, 1 Sep 2025 17:00:10 +0900 Subject: [PATCH 28/35] =?UTF-8?q?=EA=B2=B0=ED=95=A8=EC=A1=B0=EC=B9=98=20?= =?UTF-8?q?=ED=95=98=EB=8A=94=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/fo/app/components/common/DataForm.tsx | 5 +- .../dashboard/maingraph/page.tsx | 35 ++++++++++-- .../pages/(with-layout)/dashboard/page.tsx | 55 ++++++++++++++++++- apps/fo/app/store/dashboard/index.tsx | 28 +++++++++- apps/fo/app/store/processFacility/index.tsx | 2 +- 5 files changed, 113 insertions(+), 12 deletions(-) diff --git a/apps/fo/app/components/common/DataForm.tsx b/apps/fo/app/components/common/DataForm.tsx index c478826f0..4c6f2840f 100644 --- a/apps/fo/app/components/common/DataForm.tsx +++ b/apps/fo/app/components/common/DataForm.tsx @@ -39,10 +39,7 @@ export default function DataForm({ type, column, item }: DataFormProps) { break; case 'float0': if(value) { - item[column] = String(value).includes('.')?String(Math.round(parseFloat(value.toString().replace(/,/g, '')) * 1) / 1).split('.').map((part, index) => - index === 0 ? part.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : part - ).join('.') - : String(value).replace(/\B(?=(\d{3})+(?!\d))/g, ","); + item[column] = roundNumber(value, 0); } break; case 'float1': diff --git a/apps/fo/app/pages/(with-layout)/dashboard/maingraph/page.tsx b/apps/fo/app/pages/(with-layout)/dashboard/maingraph/page.tsx index 22143b842..3f193e035 100644 --- a/apps/fo/app/pages/(with-layout)/dashboard/maingraph/page.tsx +++ b/apps/fo/app/pages/(with-layout)/dashboard/maingraph/page.tsx @@ -22,10 +22,12 @@ export default function DashBoardChart({searchYear = '', fcltyList = []}: facili const [chart_tpTp, setChart_tpTp] = useState<{ chartData1: lineChartDataProps[]; chartData2: lineChartDataProps[]; + chartData3: lineChartDataProps[]; }>(); const [chart_tntn, setChart_tntn] = useState<{ chartData1: lineChartDataProps[]; chartData2: lineChartDataProps[]; + chartData3: lineChartDataProps[]; }>(); const [chart_inflBodInflTn, setChart_inflBodInflTn] = useState<{ chartData1: lineChartDataProps[]; @@ -46,6 +48,7 @@ export default function DashBoardChart({searchYear = '', fcltyList = []}: facili chart_efflTn, chart_inflBod, isLoadingMainGraph, + waterQltyStandartd, } = MainGraph; /** @@ -90,6 +93,10 @@ export default function DashBoardChart({searchYear = '', fcltyList = []}: facili label: '방류T-P', color: colors[1], }, + chartData3: { + label : '법적방류T-P', + color : 'blackdash', + } } satisfies ChartConfig; // 유입T-N-방류T-N @@ -102,6 +109,10 @@ export default function DashBoardChart({searchYear = '', fcltyList = []}: facili label: '방류T-N', color: colors[1], }, + chartData3: { + label : '법적방류T-N', + color : 'blackdash', + } } satisfies ChartConfig; // 유입BOD-유입T-N @@ -139,21 +150,37 @@ export default function DashBoardChart({searchYear = '', fcltyList = []}: facili useEffect(() => { if (!chart_chongInTp || !chart_efflTp) return; + const legalTpData: lineChartDataProps[] = []; + if (waterQltyStandartd){ + chart_inflTn.forEach(item =>{ + legalTpData.push({label : item.label, val:waterQltyStandartd.tp}); + }) + } + const chartTpTpData = { chartData1: chart_chongInTp, - chartData2: chart_efflTp + chartData2: chart_efflTp, + chartData3: legalTpData }; setChart_tpTp(chartTpTpData); - }, [chart_chongInTp, chart_efflTp]); + }, [chart_chongInTp, chart_efflTp, chart_inflTn, waterQltyStandartd]); useEffect(() => { if (!chart_inflTn || !chart_efflTn) return; + const legalTnData: lineChartDataProps[] = []; + if (waterQltyStandartd){ + chart_inflTn.forEach(item =>{ + legalTnData.push({label : item.label, val:waterQltyStandartd.tn}); + }) + } + const chartTntnData = { chartData1: chart_inflTn, - chartData2: chart_efflTn + chartData2: chart_efflTn, + chartData3: legalTnData, }; setChart_tntn(chartTntnData); - }, [chart_inflTn, chart_efflTn]); + }, [chart_inflTn, chart_efflTn, waterQltyStandartd]); useEffect(() => { if (!chart_inflBod || !chart_inflTn) return; diff --git a/apps/fo/app/pages/(with-layout)/dashboard/page.tsx b/apps/fo/app/pages/(with-layout)/dashboard/page.tsx index df41340e4..31b7da073 100644 --- a/apps/fo/app/pages/(with-layout)/dashboard/page.tsx +++ b/apps/fo/app/pages/(with-layout)/dashboard/page.tsx @@ -18,6 +18,22 @@ const tabList = [ //{ value: 'drainageEquipment', label: '배수설비 정비현황' } ]; +export const generateYearDates = (searchYear: string) => { + const dates: string[] = []; + const start = new Date(Number(searchYear), 0, 1); // 1월 1일 + const end = new Date(Number(searchYear), 11, 31); // 12월 31일 + + for (let d = new Date(start); d <= end; d.setDate(d.getDate() + 1)) { + const year = d.getFullYear(); + const month = String(d.getMonth() + 1).padStart(2, "0"); + const day = String(d.getDate()).padStart(2, "0"); + + dates.push(`${year}-${month}-${day}`); // YYYY-MM-DD 형식 + } + + return dates; +} + export default function DashBoard() { // 입력값 상태 관리 const { Common, initializeCommonData,searchMainGraph, searchRainManage, searchOperationStatus, OperationStatus, RainManage, MainGraph, PlanFclty } = useFoStore((state) => state); @@ -191,9 +207,46 @@ export default function DashBoard() { case 'mainGraph': searchMainGraph(searchYear, fcltyList.bscFctCd); + const yearData = generateYearDates(searchYear); + const yearValueData : any = []; + + for (const i in yearData){ + const rowArray: string[] = []; + rowArray.push(yearData[i] ?? ""); + //강수량 + rowArray.push(roundNumber(chart_inflowRain.filter(item=>{return yearData[i] === item.label})[0]?.barVal0?.toString(), 1) || ''); + //유입하수량 + rowArray.push(roundNumber(chart_inflowRain.filter(item=>{return yearData[i] === item.label})[0]?.lineVal1?.toString(), 0) || ''); + //시설용량 + rowArray.push(roundNumber(chart_inflowRain.filter(item=>{return yearData[i] === item.label})[0]?.lineVal0?.toString(), 0) || ''); + //유입BOD + rowArray.push(roundNumber(chart_bodRain.filter(item=>{return yearData[i] === item.label})[0]?.lineVal0?.toString(), 1) || ''); + //유입T-P + rowArray.push(roundNumber(chart_inflTp.filter(item=>{return yearData[i] === item.label})[0]?.val?.toString(), 3) || ''); + //총인유입T-P + rowArray.push(roundNumber(chart_chongInTp.filter(item=>{return yearData[i] === item.label})[0]?.val?.toString(), 3) || ''); + //방류T-P + rowArray.push(roundNumber(chart_efflTp.filter(item=>{return yearData[i] === item.label})[0]?.val?.toString(), 3) || ''); + //유입T-N + rowArray.push(roundNumber(chart_inflTn.filter(item=>{return yearData[i] === item.label})[0]?.val?.toString(), 3) || ''); + //방류T-N + rowArray.push(roundNumber(chart_efflTn.filter(item=>{return yearData[i] === item.label})[0]?.val?.toString(), 3) || ''); + + yearValueData.push( + rowArray + ) + } + console.log(yearValueData); + /* const excelData = [['날짜', '강수량', '유입하수량','시설용량', '유입BOD', '유입T-P', '총인유입T-P', '방류T-P'], */ const sheetParameter = [ { + data: [['날짜', '강수량', '유입하수량', '시설용량', '유입BOD', '유입T-P','총인유입T-P', '방류T-P', '유입T-N', '방류T-N'],...yearValueData], + headerNum: 1, + headerRange: 'A1:J1', + sheetName: '주요그래프' + } + /* { data: [['날짜', '강수량'],...chart_inflowRain.map((item) => [item.label, roundNumber(item.barVal0, 1)])], headerNum: 1, headerRange: 'A1:B1', @@ -246,7 +299,7 @@ export default function DashBoard() { headerNum: 1, headerRange: 'A1:B1', sheetName: '방류T-N' - } + } */ ]; downloadMultipleExcel('주요그래프', sheetParameter); diff --git a/apps/fo/app/store/dashboard/index.tsx b/apps/fo/app/store/dashboard/index.tsx index 11a215a1d..958346b74 100644 --- a/apps/fo/app/store/dashboard/index.tsx +++ b/apps/fo/app/store/dashboard/index.tsx @@ -6,8 +6,9 @@ import { getFetch } from "@/app/components/api"; import CalcRainEffect from "@/app/components/common/CalcRainEffect"; import DataForm from "@/app/components/common/DataForm"; import { fetchPlanInfo, OSU_PERCENT, qltyDataSetting, roundUp } from "../common"; -import type { FacilityWaterQltyProps } from "../facilityWaterQlty"; +import { type FacilityWaterQltyProps } from "../facilityWaterQlty"; import { fetchFlowRateModalList } from "../flowRate"; +import { fetchFacilityWaterQltyInfo } from "../processFacility"; // selectBox export type SelectDataType = { @@ -100,7 +101,7 @@ export type lineBarChartDataProps = { export type lineChartDataProps = { label : string, - val : number + val : number, } export interface RainManageListProps { @@ -662,6 +663,7 @@ const chart_inflTn : lineChartDataProps[] = []; const chart_efflTn : lineChartDataProps[] = []; const chart_inflBod : lineChartDataProps[] = []; const chart_efflBod : lineChartDataProps[] = []; +const waterQltyStandartd : any = []; const rainManageList : RainManageListProps[] = []; @@ -1034,6 +1036,7 @@ export type DashBoardType = { chart_efflTn : lineChartDataProps[]; chart_inflBod : lineChartDataProps[]; chart_efflBod : lineChartDataProps[]; + waterQltyStandartd : any; isLoadingMainGraph : boolean; }, @@ -1096,6 +1099,7 @@ export const dashBoardInitState:DashBoardType = { chart_efflTn : chart_efflTn, chart_inflBod : chart_inflBod, chart_efflBod : chart_efflBod, + waterQltyStandartd : waterQltyStandartd, isLoadingMainGraph : false, }, @@ -1817,6 +1821,24 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) }, })); const res = await fetchMainGraph(searchYear, fcltyCd); + const res2 = await fetchFacilityWaterQltyInfo(fcltyCd); + + // 법적방류수질 데이터 + const sortedWaterQltyInfo = [...res2].sort((a, b) => { + // 숫자로 변환하여 비교 + const numA = Number(a.extnsSeqno); + const numB = Number(b.extnsSeqno); + if (!isNaN(numA) && !isNaN(numB)) { + return numA - numB; + } + // 숫자 변환이 실패하면 문자열로 비교 + return String(a.extnsSeqno).localeCompare(String(b.extnsSeqno)); + }); + + const waterQltyStandartd : any = sortedWaterQltyInfo && sortedWaterQltyInfo.length > 0 + ? sortedWaterQltyInfo[sortedWaterQltyInfo.length - 1] + : []; + if(res == null || res.data == null || res.data.length === 0) { set((state: DashBoardType) => ({ ...state, @@ -1831,6 +1853,7 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) chart_efflTn: [], chart_inflBod: [], chart_efflBod: [], + waterQltyStandartd : [], isLoadingMainGraph : false, } })); @@ -1898,6 +1921,7 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) chart_efflTn: chart_efflTn, chart_inflBod: chart_inflBod, chart_efflBod: chart_efflBod, + waterQltyStandartd : waterQltyStandartd, isLoadingMainGraph : false, }, })) diff --git a/apps/fo/app/store/processFacility/index.tsx b/apps/fo/app/store/processFacility/index.tsx index bb9fdb086..da6589001 100644 --- a/apps/fo/app/store/processFacility/index.tsx +++ b/apps/fo/app/store/processFacility/index.tsx @@ -456,7 +456,7 @@ const fetchFacilityHistInfo = async (facilityCd:string ): Promise<fcltyHistInfoP }; // 시설정보 수질정보 데이터 호출 -const fetchFacilityWaterQltyInfo = async (facilityCd:string ): Promise<fcltyWaterQltyInfoProps[]> => { +export const fetchFacilityWaterQltyInfo = async (facilityCd:string ): Promise<fcltyWaterQltyInfoProps[]> => { try { const res = await getFetch('fo', '/prcsFclt/info/history/'+facilityCd); const data = res.data; From 34e88c6b63e041ccd23a3fd1f61da95f23e3bafa Mon Sep 17 00:00:00 2001 From: jsyang <mind-one003@mind-one.co.kr> Date: Tue, 2 Sep 2025 09:17:15 +0900 Subject: [PATCH 29/35] =?UTF-8?q?=EB=82=A0=EC=A7=9C=ED=98=95=EC=8B=9D=20?= =?UTF-8?q?=EC=98=A4=EB=A5=98=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/components/common/DataForm.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/fo/app/components/common/DataForm.tsx b/apps/fo/app/components/common/DataForm.tsx index 4c6f2840f..48b428e32 100644 --- a/apps/fo/app/components/common/DataForm.tsx +++ b/apps/fo/app/components/common/DataForm.tsx @@ -39,7 +39,10 @@ export default function DataForm({ type, column, item }: DataFormProps) { break; case 'float0': if(value) { - item[column] = roundNumber(value, 0); + item[column] = item[column] = String(value).includes('.')?String(Math.round(parseFloat(value.toString().replace(/,/g, '')) * 1) / 1).split('.').map((part, index) => + index === 0 ? part.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : part + ).join('.') + : String(value).replace(/\B(?=(\d{3})+(?!\d))/g, ","); } break; case 'float1': From 2f00efadfc940e7b400114532e2be5b83c3ad89b Mon Sep 17 00:00:00 2001 From: jsyang <mind-one003@mind-one.co.kr> Date: Tue, 2 Sep 2025 16:43:38 +0900 Subject: [PATCH 30/35] =?UTF-8?q?-=20=EB=AF=B8=EC=B2=98=EB=A6=AC=ED=95=98?= =?UTF-8?q?=EC=88=98=EB=9F=89=20=EC=BB=AC=EB=9F=BC=20=EC=B6=94=EA=B0=80=20?= =?UTF-8?q?-=20=EC=97=B0=20=ED=8F=89=EA=B7=A0=20>=20=EC=97=B0=ED=8F=89?= =?UTF-8?q?=EA=B7=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../facilityWaterQlty/modal/page.tsx | 51 ++++++++++++++----- .../(with-layout)/flowRate/modal/page.tsx | 27 ++++++++-- apps/fo/app/store/facilityWaterQlty/index.tsx | 36 ++++++++++++- apps/fo/app/store/flowRate/index.tsx | 50 +++++++++++++++--- apps/fo/app/store/underWaterInput/index.tsx | 8 ++- 5 files changed, 142 insertions(+), 30 deletions(-) diff --git a/apps/fo/app/pages/(with-layout)/facilityWaterQlty/modal/page.tsx b/apps/fo/app/pages/(with-layout)/facilityWaterQlty/modal/page.tsx index 48a94aa89..18a71848b 100644 --- a/apps/fo/app/pages/(with-layout)/facilityWaterQlty/modal/page.tsx +++ b/apps/fo/app/pages/(with-layout)/facilityWaterQlty/modal/page.tsx @@ -7,6 +7,7 @@ import { useCallback, useEffect, useRef, useState } from "react"; import type { ReturnType } from "../../../../components/common/FacilityTermModalHeader"; import FacilityTermModalHeader from "../../../../components/common/FacilityTermModalHeader"; import { HeadMakeColSpan } from "../HeadMakeColSpan"; +import { roundNumber } from "@/app/components/common/DataForm"; type ModalProps ={ fcltyName: string; @@ -74,8 +75,10 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe let maxTpInflWqltBod = 0; let maxTpInflWqltTp = 0; + let maxNoProcessInflAmnt = 0; let maxInfoRnDay = 0; + // 초기값 설정 let minEfflWqltBod = filteredData.length > 0 ? parseNumber(filteredData[0]?.efflWqltBod) : 0; let minEfflWqltTn = filteredData.length > 0 ? parseNumber(filteredData[0]?.efflWqltTn) : 0; @@ -89,9 +92,9 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe let mininflAssctBfrWqltToc = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctBfrWqltToc) : 0; let mininflAssctBfrWqltSs = filteredData.length > 0 ? parseNumber(filteredData[0]?.inflAssctBfrWqltSs) : 0; - let minTpInflWqltBod = filteredData.length > 0 ? parseNumber(filteredData[0]?.tpInflWqltBod) : 0; - let minTpInflWqltTp = filteredData.length > 0 ? parseNumber(filteredData[0]?.tpInflWqltTp) : 0; - + let minTpInflWqltBod = 99999999; + let minTpInflWqltTp = 99999999; + let minNoProcessInflAmnt = 99999999; let minInfoRnDay = filteredData.length > 0 ? parseNumber(filteredData[0]?.infoRnDay) : 0; let avgEfflWqltBod = 0; @@ -108,6 +111,10 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe let avgTpInflWqltBod = 0; let avgTpInflWqltTp = 0; + let tpInflWqltBodCnt = 0; + let tpInflWqltTpCnt = 0; + let avgNoProcessInflAmnt = 0; + let noProcessInflAmntCnt = 0; let avgInfoRnDay = 0; @@ -123,9 +130,14 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe const inflAssctBfrWqltToc = parseNumber(item.inflAssctBfrWqltToc); const inflAssctBfrWqltSs = parseNumber(item.inflAssctBfrWqltSs); - const tpInflWqltBod = parseNumber(item.tpInflWqltBod); const tpInflWqltTp = parseNumber(item.tpInflWqltTp); + if(item.tpInflWqltBod != null && item.tpInflWqltBod.trim() != '' && item.tpInflWqltBod != undefined ){ + tpInflWqltBodCnt += 1; + } + if(item.tpInflWqltTp != null && item.tpInflWqltTp.trim() != '' && item.tpInflWqltTp != undefined ){ + tpInflWqltTpCnt += 1; + } const infoRnDay = parseNumber(item.infoRnDay); @@ -158,8 +170,14 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe mininflAssctBfrWqltToc = Math.min(mininflAssctBfrWqltToc, inflAssctBfrWqltToc); mininflAssctBfrWqltSs = Math.min(mininflAssctBfrWqltSs, inflAssctBfrWqltSs); - minTpInflWqltBod = Math.min(minTpInflWqltBod, tpInflWqltBod); - minTpInflWqltTp = Math.min(minTpInflWqltTp, tpInflWqltTp); + if(item.tpInflWqltBod != null && item.tpInflWqltBod.trim() != '' && item.tpInflWqltBod != undefined ){ + minTpInflWqltBod = Math.min(minTpInflWqltBod, tpInflWqltBod); + avgTpInflWqltBod += tpInflWqltBod; + } + if(item.tpInflWqltTp != null && item.tpInflWqltTp.trim() != '' && item.tpInflWqltTp != undefined ){ + minTpInflWqltTp = Math.min(minTpInflWqltTp, tpInflWqltTp); + avgTpInflWqltTp += tpInflWqltTp; + } minInfoRnDay = Math.min(minInfoRnDay, infoRnDay); @@ -175,8 +193,13 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe avginflAssctBfrWqltToc += inflAssctBfrWqltToc; avginflAssctBfrWqltSs += inflAssctBfrWqltSs; - avgTpInflWqltBod += tpInflWqltBod; - avgTpInflWqltTp += tpInflWqltTp; + if(item.noProcessInflAmnt && item.noProcessInflAmnt.toString().trim() != '' && item.noProcessInflAmnt != undefined){ + const noProcessInflAmnt = Number(item.noProcessInflAmnt.toString().replaceAll(',','')); + avgNoProcessInflAmnt += noProcessInflAmnt; + maxNoProcessInflAmnt = Math.max(maxNoProcessInflAmnt, noProcessInflAmnt); + minNoProcessInflAmnt = Math.min(minNoProcessInflAmnt, noProcessInflAmnt); + noProcessInflAmntCnt +=1; + } avgInfoRnDay += infoRnDay; }); @@ -201,9 +224,10 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe sggNm: "", addr: "", fctCpc: 0, + noProcessInflAmnt : roundNumber(avgNoProcessInflAmnt / noProcessInflAmntCnt, 0), infoRnDay: filteredData.length==0?'0.0':(Math.round(avgInfoRnDay / filteredData.length * 10) / 10).toFixed(1), - tpInflWqltBod: filteredData.length==0?'0.0':(Math.round(avgTpInflWqltBod / filteredData.length * 10) / 10).toFixed(1), - tpInflWqltTp: filteredData.length==0?'0.000':(Math.round(avgTpInflWqltTp / filteredData.length * 1000) / 1000).toFixed(3) + tpInflWqltBod: filteredData.length==0?'0.0':(Math.round(avgTpInflWqltBod / tpInflWqltBodCnt * 10) / 10).toFixed(1), + tpInflWqltTp: filteredData.length==0?'0.000':(Math.round(avgTpInflWqltTp / tpInflWqltTpCnt * 1000) / 1000).toFixed(3) }, { msrDt : '최대', @@ -224,6 +248,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe sggNm: "", addr: "", fctCpc: 0, + noProcessInflAmnt : roundNumber(maxNoProcessInflAmnt, 0), infoRnDay: Math.round(maxInfoRnDay * 10) / 10?(Math.round(maxInfoRnDay * 10) / 10).toFixed(1):'0.0', tpInflWqltBod: Math.round(maxTpInflWqltBod * 10) / 10?(Math.round(maxTpInflWqltBod * 10) / 10).toFixed(1):'0.0', tpInflWqltTp: Math.round(maxTpInflWqltTp * 1000) / 1000?(Math.round(maxTpInflWqltTp * 1000) / 1000).toFixed(3):'0.000' @@ -247,12 +272,14 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe sggNm: "", addr: "", fctCpc: 0, + noProcessInflAmnt : roundNumber(minNoProcessInflAmnt, 0), infoRnDay: Math.round(minInfoRnDay * 10) / 10?'0.0':(Math.round(minInfoRnDay * 10) / 10).toFixed(1), - tpInflWqltBod: Math.round(minTpInflWqltBod * 10) / 10?'0.0':(Math.round(minTpInflWqltBod * 10) / 10).toFixed(1), - tpInflWqltTp: Math.round(minTpInflWqltTp * 1000) / 1000?'0.000':(Math.round(minTpInflWqltTp * 1000) / 1000).toFixed(3) + tpInflWqltBod: Math.round(minTpInflWqltBod * 10) / 10 && minTpInflWqltBod != 99999999?(Math.round(minTpInflWqltBod * 10) / 10).toFixed(1):'0.0', + tpInflWqltTp: Math.round(minTpInflWqltTp * 1000) / 1000 && minTpInflWqltTp != 99999999?(Math.round(minTpInflWqltTp * 1000) / 1000).toFixed(3):'0.000' }, ...filteredData ]; + return newFilteredData; } diff --git a/apps/fo/app/pages/(with-layout)/flowRate/modal/page.tsx b/apps/fo/app/pages/(with-layout)/flowRate/modal/page.tsx index 87b398350..b38aea419 100644 --- a/apps/fo/app/pages/(with-layout)/flowRate/modal/page.tsx +++ b/apps/fo/app/pages/(with-layout)/flowRate/modal/page.tsx @@ -7,6 +7,7 @@ import { Button, TabsContent } from "@common/components/ui"; import { useCallback, useEffect, useRef, useState } from "react"; import type { ReturnType } from "../../../../components/common/FacilityTermModalHeader"; import { roundUp } from "@/app/store/common"; +import { roundNumber } from "@/app/components/common/DataForm"; const tabList = [ { value: 'tab_term_year', label: '연간' }, @@ -59,6 +60,7 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st let maxreturnAmnt = 0; let maxefflAmnt = 0; let maxinfoRnDay = 0; + let maxNoProcessInflAmnt = 0; // 초기값 설정 let mintotInflAmnt = parseNumber(filteredData[0]?.totInflAmnt); @@ -67,6 +69,7 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st let minreturnAmnt = parseNumber(filteredData[0]?.returnAmnt); let minefflAmnt = parseNumber(filteredData[0]?.efflAmnt); let mininfoRnDay = parseNumber(filteredData[0]?.infoRnDay && filteredData[0]?.infoRnDay.toString().trim() !== 'x' ? filteredData[0]?.infoRnDay.toString().trim() : 0); + let minNoProcessInflAmnt = 99999999; let avgtotInflAmnt = 0; let avginflAmnt = 0; @@ -74,6 +77,8 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st let avgreturnAmnt = 0; let avgefflAmnt = 0; let avginfoRnDay = 0; + let avgNoProcessInflAmnt = 0; + let noProcessInflAmntCnt = 0; filteredData.forEach((item: FlowRateModalInterface) => { const totInflAmnt = parseNumber(item.totInflAmnt); @@ -82,6 +87,7 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st const returnAmnt = parseNumber(item.returnAmnt); const efflAmnt = parseNumber(item.efflAmnt); const infoRnDay = parseNumber(item.infoRnDay && item.infoRnDay.toString().trim() !== 'x' ? item.infoRnDay.toString().trim() : 0); + maxtotInflAmnt = Math.max(maxtotInflAmnt, totInflAmnt); maxinflAmnt = Math.max(maxinflAmnt, inflAmnt); maxsumFlow = Math.max(maxsumFlow, sumFlow); @@ -102,16 +108,25 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st avgreturnAmnt += returnAmnt; avgefflAmnt += efflAmnt; avginfoRnDay += infoRnDay; + + if(item.noProcessInflAmnt && item.noProcessInflAmnt.toString().trim() != '' && item.noProcessInflAmnt != undefined){ + const noProcessInflAmnt = Number(item.noProcessInflAmnt.toString().replaceAll(',','')); + avgNoProcessInflAmnt += noProcessInflAmnt; + maxNoProcessInflAmnt = Math.max(maxNoProcessInflAmnt, noProcessInflAmnt); + minNoProcessInflAmnt = Math.min(minNoProcessInflAmnt, noProcessInflAmnt); + noProcessInflAmntCnt +=1; + } }); const newFilteredData = [ { msrDt: '평균', - totInflAmnt: roundUp((avgtotInflAmnt / filteredData.length), 0), - inflAmnt: roundUp((avginflAmnt / filteredData.length), 0), - sumFlow: roundUp((avgsumFlow / filteredData.length), 0), - returnAmnt: roundUp((avgreturnAmnt / filteredData.length), 0), - efflAmnt: roundUp((avgefflAmnt / filteredData.length), 0), + totInflAmnt: avgtotInflAmnt && avgtotInflAmnt!=0 ? roundUp((avgtotInflAmnt / filteredData.length), 0) : 0, + inflAmnt: avginflAmnt && avginflAmnt!=0 ? roundUp((avginflAmnt / filteredData.length), 0) : 0, + sumFlow: avgsumFlow && avgsumFlow!=0 ? roundUp((avgsumFlow / filteredData.length), 0) : 0, + returnAmnt: avgreturnAmnt && avgreturnAmnt!=0 ? roundUp((avgreturnAmnt / filteredData.length), 0) : 0, + efflAmnt: avgefflAmnt && avgefflAmnt!=0 ? roundUp((avgefflAmnt / filteredData.length), 0) : 0, + noProcessInflAmnt : roundNumber(avgNoProcessInflAmnt / noProcessInflAmntCnt, 0), infoRnDay: avginfoRnDay > 0 ? roundUp((avginfoRnDay / filteredData.length), 1) : '0.0', rainEffectDay: 0, }, @@ -122,6 +137,7 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st sumFlow: roundUp(maxsumFlow, 0), returnAmnt: roundUp(maxreturnAmnt, 0), efflAmnt: roundUp(maxefflAmnt, 0), + noProcessInflAmnt : roundNumber(maxNoProcessInflAmnt, 0), infoRnDay: maxinfoRnDay > 0 ? roundUp(maxinfoRnDay, 1) : '0.0', rainEffectDay: 0, }, @@ -132,6 +148,7 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st sumFlow: roundUp(minsumFlow, 0), returnAmnt: roundUp(minreturnAmnt, 0), efflAmnt: roundUp(minefflAmnt, 0), + noProcessInflAmnt : roundNumber(minNoProcessInflAmnt, 0), infoRnDay: mininfoRnDay > 0 ? roundUp(mininfoRnDay, 1) : '0.0', rainEffectDay: 0, }, diff --git a/apps/fo/app/store/facilityWaterQlty/index.tsx b/apps/fo/app/store/facilityWaterQlty/index.tsx index 0eded855b..f8b874c85 100644 --- a/apps/fo/app/store/facilityWaterQlty/index.tsx +++ b/apps/fo/app/store/facilityWaterQlty/index.tsx @@ -1,5 +1,5 @@ import { getFetch } from "@/app/components/api"; -import DataForm from "@/app/components/common/DataForm"; +import DataForm, { roundNumber } from "@/app/components/common/DataForm"; import type { TableUpperProps } from "../dashboard"; import CalcRainEffect from "@/app/components/common/CalcRainEffect"; export type { TableUpperProps }; @@ -54,6 +54,7 @@ export interface FacilityWaterQltyProps { tpInflWqltTp: string | '', tpInflWqltEclgyTox: string | '', tpInflWqltClfgrpcnt: string | '', + noProcessInflAmnt : string | number | '', } export interface ExcelType { 시설코드: string, @@ -209,6 +210,7 @@ const upHeadListModalYear: TableUpperProps[] = [ { id: "efflWqltSs", title: "SS\n(mg/L)", upName: "upChangeRe2", upSequnce: 3, align: "right" }, { id: "efflWqltTn", title: "T-N\n(mg/L)", upName: "upChangeRe2", upSequnce: 2, align: "right" }, { id: "efflWqltTp", title: "T-P\n(mg/L)", upName: "upChangeRe2", upSequnce: 3, align: "right" }, + { id: "noProcessInflAmnt", title: "미처리하수량\n(m³/일)", align:"right"}, { id: "infoRnDay", title: "강우량\n(mm/일)", align: "right" } ]; @@ -577,6 +579,32 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType // facilityPrecipitation의 rainEffectDay 계산 로직을 적용 const data = CalcRainEffect(res.data.wqltObjs); + /** + * [(강우시 일별유입유량*강우시 일별유입BOD)-(청천시 연평균유입유량*청천시 연평균유입BOD)]​ + /강우시 일별유입BOD) + */ + //let rainInflAmnt = 0; + let sunnyInflAmnt = 0; + let sunnyBod = 0; + //let rainDay = 0; + let sunnyDay = 0; + + data.forEach(item => { + if(item.rainEffectDay == 1){ + //rainDay += 1; + //rainInflAmnt += Number(item.inflAmnt); + } else { + sunnyDay += 1; + sunnyInflAmnt += Number(item.inflAmnt); + sunnyBod += Number(item.inflAssctBfrWqltBod); + } + }); + + //const yearRainAmnt = rainInflAmnt===0?0:rainInflAmnt / rainDay; + const yearSunnyAmnt = sunnyInflAmnt===0?0:sunnyInflAmnt / sunnyDay; + const yearSunnyBod = sunnyBod===0?0:sunnyBod / sunnyDay; + // + const rtnData = data.map((item: FacilityWaterQltyProps) => { dataFormSetting(item) if(item.inflAssctBfrWqltTn) { @@ -626,7 +654,11 @@ export const facilityWaterQltyReducer = (set: (fn: (state: FacilityWaterQltyType }else{ item.tpInflWqltTp = ''; } - + + const dayBod = Number(item.inflAssctBfrWqltBod); + const noProcessInflAmnt = roundNumber(((Number(item.inflAmnt) * dayBod) - (yearSunnyAmnt * yearSunnyBod)) / dayBod, 0) + item.noProcessInflAmnt = noProcessInflAmnt && Number(noProcessInflAmnt.replaceAll(',','')) > 0 ? noProcessInflAmnt : ''; + return item; }) set((state: FacilityWaterQltyType) => ({ diff --git a/apps/fo/app/store/flowRate/index.tsx b/apps/fo/app/store/flowRate/index.tsx index c73bcc0cd..571a7ffb2 100644 --- a/apps/fo/app/store/flowRate/index.tsx +++ b/apps/fo/app/store/flowRate/index.tsx @@ -1,7 +1,8 @@ import { getFetch } from "@/app/components/api"; import type { TableUpperProps } from "../dashboard"; -import DataForm from "@/app/components/common/DataForm"; +import DataForm, { roundNumber } from "@/app/components/common/DataForm"; import CalcRainEffect from "@/app/components/common/CalcRainEffect"; +import { fetchFacilityWaterQltyListHist } from "../facilityWaterQlty"; /**==================================== * Store - 타입 @@ -71,6 +72,7 @@ export interface FlowRateModalInterface { efflAmnt : number | '', infoRnDay : number | string | '', rainEffectDay : number | string | '' , + noProcessInflAmnt : number | string | '' } export type FlowRateModalProps = { msrDt : string, @@ -81,6 +83,7 @@ export type FlowRateModalProps = { efflAmnt : number, infoRnDay : number | string | '', rainEffectDay : number | string | '', + noProcessInflAmnt : number | string | '' } /**==================================== @@ -155,6 +158,7 @@ const upHeadListFlowRateModal:TableUpperProps[] = [ { id: "sumFlow", title: "연계처리량(m³/일)", align:"right"}, { id: "returnAmnt", title: "총인 반류수량(m³/일)", align:"right"}, { id: "efflAmnt", title: "방류량(m³/일)", align:"right"}, + { id: "noProcessInflAmnt", title: "미처리하수량(m³/일)", align:"right"}, { id: "infoRnDay", title: "강우량(mm/일)", align:"right"} ] @@ -166,7 +170,8 @@ const modalFlowRateListYear:FlowRateModalProps[] = [ ====================================*/ const fetchFlowRateList = async (pageNo: number, pageSize: number, searchYear: string, partCd?: string, nameCd?: string, fcltCpct?: string, operationValue?: string, fcltyNm?: string) => { try { - const tailStr = partCd ? '/'+ partCd + '/' + nameCd + '/' + fcltCpct + '/' + operationValue + (fcltyNm && fcltyNm !== '' ? '/' + fcltyNm : '') : ''; const url = '/fclt/flow/' + pageNo + '/' + pageSize + '/' + searchYear + tailStr; + 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 } } catch (error) { @@ -319,10 +324,43 @@ export const flowRateSearchReducer:(set:(fn: (state: FlowRateSearchType) => Flow }, searchFlowRateModalList: async (bscFctCd: string, searchYear: string) => { const res = await fetchFlowRateModalList(bscFctCd, searchYear); - const data = CalcRainEffect(res.data); - console.log(data); - const rtnData = data.map((item: FlowRateModalProps) => { - item.totInflAmnt = Number(item.inflAmnt || 0) + Number(item.sumFlow || 0) + Number(item.returnAmnt || 0) + const inflData = CalcRainEffect(res.data); + + const res2 = await fetchFacilityWaterQltyListHist(searchYear, bscFctCd); + const wqltData = CalcRainEffect(res2?.data.wqltObjs); + + /** + * [(강우시 일별유입유량*강우시 일별유입BOD)-(청천시 연평균유입유량*청천시 연평균유입BOD)]​ + /강우시 일별유입BOD) + */ + //let rainInflAmnt = 0; + let sunnyInflAmnt = 0; + let sunnyBod = 0; + //let rainDay = 0; + let sunnyDay = 0; + + inflData.forEach(item => { + if(item.rainEffectDay == 1){ + //rainDay += 1; + //rainInflAmnt += Number(item.inflAmnt); + } else { + const msrDt = item.msrDt.replaceAll('-',''); + sunnyDay += 1; + sunnyInflAmnt += Number(item.inflAmnt); + sunnyBod += Number(wqltData.filter((wqitem)=>wqitem.msrDt === msrDt)[0].inflAssctBfrWqltBod); + } + }); + + //const yearRainAmnt = rainInflAmnt===0?0:rainInflAmnt / rainDay; + const yearSunnyAmnt = sunnyInflAmnt===0?0:sunnyInflAmnt / sunnyDay; + const yearSunnyBod = sunnyBod===0?0:sunnyBod / sunnyDay; + + const rtnData = inflData.map((item: FlowRateModalProps) => { + const dayBod = Number(wqltData.filter(wqitem=>wqitem.msrDt === item.msrDt.replaceAll('-',''))[0].inflAssctBfrWqltBod); + const noProcessInflAmnt = roundNumber(((Number(item.inflAmnt) * dayBod) - (yearSunnyAmnt * yearSunnyBod)) / dayBod, 0) + + item.totInflAmnt = Number(item.inflAmnt || 0) + Number(item.sumFlow || 0) + Number(item.returnAmnt || 0); + item.noProcessInflAmnt = noProcessInflAmnt && Number(noProcessInflAmnt.replaceAll(',','')) > 0 ? noProcessInflAmnt : ''; dataFormSetting(item); return item; }); diff --git a/apps/fo/app/store/underWaterInput/index.tsx b/apps/fo/app/store/underWaterInput/index.tsx index cb80d1942..4562509c1 100644 --- a/apps/fo/app/store/underWaterInput/index.tsx +++ b/apps/fo/app/store/underWaterInput/index.tsx @@ -40,7 +40,7 @@ const upHeadList1:TableUpperProps[] = [ { id: "bscFctNm", title: "시설명", row:0, rowSpan:2 }, { id: "daddr", title: "주소", row:0, rowSpan:2 }, { id: "fctCpc", title: "시설용량(m³/일)", align:"right", row:0, rowSpan:2 }, - { id: "inflAmnt", title: "연 평균유입하수량(m³/일)", align:"right", row:0, rowSpan:2 }, + { id: "inflAmnt", title: "연평균유입하수량(m³/일)", align:"right", row:0, rowSpan:2 }, { id: "C", title: "지하수 유입량 추정", align:"right", row:0, colSpan:3 }, { id: "underWaterInputYear", title: "연간\n(m³/일)", align:"right", row:1 }, { id: "underWaterInputSummer", title: "하절기\n(m³/일)", align:"right", row:1 }, @@ -56,7 +56,7 @@ const upHeadList2:TableUpperProps[] = [ { id: "bscFctNm", title: "시설명", row:0, rowSpan:2 }, { id: "daddr", title: "주소", row:0, rowSpan:2 }, { id: "fctCpc", title: "시설용량(m³/일)", align:"right", row:0, rowSpan:2 }, - { id: "inflAmnt", title: "연 평균유입하수량(m³/일)", align:"right", row:0, rowSpan:2 }, + { id: "inflAmnt", title: "연평균유입하수량(m³/일)", align:"right", row:0, rowSpan:2 }, { id: "C", title: "지하수 유입량 추정", align:"right", row:0, colSpan:3 }, { id: "underWaterInputYear", title: "연간\n(m³/일)", align:"right", row:1 }, { id: "underWaterInputSummer", title: "하절기\n(m³/일)", align:"right", row:1 }, @@ -76,7 +76,7 @@ const upHeadList3:TableUpperProps[] = [ { id: "bscFctNm", title: "시설명", row:0, rowSpan:2 }, { id: "daddr", title: "주소", row:0, rowSpan:2 }, { id: "fctCpc", title: "시설용량(m³/일)", align:"right", row:0, rowSpan:2 }, - { id: "inflAmnt", title: "연 평균유입하수량(m³/일)", align:"right", row:0, rowSpan:2 }, + { id: "inflAmnt", title: "연평균유입하수량(m³/일)", align:"right", row:0, rowSpan:2 }, { id: "C", title: "지하수 유입량 추정", align:"right", row:0, colSpan:3 }, { id: "underWaterInputYear", title: "연간\n(m³/일)", align:"right", row:1 }, { id: "underWaterInputSummer", title: "하절기\n(m³/일)", align:"right", row:1 }, @@ -426,9 +426,7 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy minWaterUsage = 0; } - console.log('tot', tot, 'calData.length', calData.length); avgWaterUsage = tot/cnt; - console.log(avgWaterUsage); const newData= [ { msrDt: '평균', From 83f5d878e7b0f9090069c48fa7ad964a7dd25ae7 Mon Sep 17 00:00:00 2001 From: jsyang <mind-one003@mind-one.co.kr> Date: Tue, 2 Sep 2025 16:44:43 +0900 Subject: [PATCH 31/35] =?UTF-8?q?=EB=9D=BC=EC=9D=B8=EB=B0=94=20y=EC=B6=95?= =?UTF-8?q?=20=EB=B2=94=EC=9C=84=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/ui/chart/LineBarChart.tsx | 38 +++++++++++++++++-- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/packages/common/business_components/src/ui/chart/LineBarChart.tsx b/packages/common/business_components/src/ui/chart/LineBarChart.tsx index a7319cb01..eee09fb65 100644 --- a/packages/common/business_components/src/ui/chart/LineBarChart.tsx +++ b/packages/common/business_components/src/ui/chart/LineBarChart.tsx @@ -109,6 +109,35 @@ export default function LineBarchart({ const lineMaxValue = getMaxValue(chartData, 'lineVal'); const barMaxValue = getMaxValue(chartData, 'barVal'); + /** + * 최대값과 구간 수에 따른 범례 만들기 + * maxValue : 최대값, segments : 구간 수 (구간수가 5면 눈금은 6) + */ + const makeNiceScale = (maxValue: number, segments = 5) => { + // 최대값이 이상할 경우 0, 0으로 반환 + if (!isFinite(maxValue) || maxValue <= 0) { + return { max: 0, ticks: [0] }; + } + + const exponent = Math.floor(Math.log10(maxValue)); + const base = Math.pow(10, exponent); + const fraction = maxValue / base; + + let niceFraction: number; + if (fraction <= 1) niceFraction = 1; + else if (fraction <= 2) niceFraction = 3; + else if (fraction <= 5) niceFraction = 5; + else niceFraction = 10; + + const niceMax = niceFraction * base; // round up to 1/2/5 * 10^k + const step = niceMax / segments; + const ticks = Array.from({ length: segments + 1 }, (_, i) => Number((i * step).toFixed(10))); + return { max: niceMax, ticks }; + }; + + const leftScale = makeNiceScale(lineMaxValue, 5); + const rightScale = makeNiceScale(barMaxValue, 5); + const getTicks = (data : any []) => { const monthSet = new Set<string>(); const rtnData : string[] = []; @@ -182,23 +211,26 @@ export default function LineBarchart({ {yFieldText && <YAxis yAxisId="left" className="text-[12px] font-bold" - tickCount={6} tickFormatter={(value) => typeof value === "number" ? value.toLocaleString() : value } + domain={[0, leftScale.max]} + ticks={leftScale.ticks} orientation="left" label={(props) => <CustomAxisText {...props} fieldText={yFieldText} position="left" />} + />} {/* 오른쪽 Y축: barVal */} {yFieldText2 && <YAxis yAxisId="right" className="text-[12px] font-bold" - tickCount={6} orientation="right" tickFormatter={(value) => typeof value === "number" ? value.toLocaleString() : value } - label={(props) => <CustomAxisText {...props} fieldText={yFieldText} position="right" />} + domain={[0, rightScale.max]} + ticks={rightScale.ticks} + label={(props) => <CustomAxisText {...props} fieldText={yFieldText2} position="right" />} reversed={true} />} <Tooltip content={<CustomTooltip active={undefined} payload={undefined} label={undefined} />} /> From 236cc9fdd2882febd91b0f44d7c0c3f90c888f48 Mon Sep 17 00:00:00 2001 From: jsyang <mind-one003@mind-one.co.kr> Date: Tue, 2 Sep 2025 17:18:19 +0900 Subject: [PATCH 32/35] =?UTF-8?q?=EB=AF=B8=EC=B2=98=EB=A6=AC=ED=95=98?= =?UTF-8?q?=EC=88=98=EB=9F=89=20=EC=A3=BC=EC=84=9D=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../facilityWaterQlty/modal/page.tsx | 72 +++++++++++-------- .../(with-layout)/flowRate/modal/page.tsx | 16 +++++ 2 files changed, 58 insertions(+), 30 deletions(-) diff --git a/apps/fo/app/pages/(with-layout)/facilityWaterQlty/modal/page.tsx b/apps/fo/app/pages/(with-layout)/facilityWaterQlty/modal/page.tsx index 18a71848b..d7cad3367 100644 --- a/apps/fo/app/pages/(with-layout)/facilityWaterQlty/modal/page.tsx +++ b/apps/fo/app/pages/(with-layout)/facilityWaterQlty/modal/page.tsx @@ -406,7 +406,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe ref={ref} queryClick={filterData} /> - <div className="overflow-y-auto h-[550px]"> + <div className="overflow-y-auto h-[500px]"> <UiTable headName={undefined} tableData={copyYearList} @@ -421,6 +421,10 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe <HeadMakeColSpan upHeadList={upHeadListModalYear} layoutNum={3} /> </UiTable> </div> + <div className="mt-14"> + <span className="text-2xl font-bold text-gray-500">☞ 미처리하수량 =[(강우시 일별유입유량*강우시 일별유입BOD)-(청천시 연평균유입유량*청천시 연평균유입BOD)]​/강우시 일별유입BOD)​</span><br></br> + <span className="text-2xl font-bold text-gray-500">☞ 음수값 발생시 제외(null, 평균값 산정시 제외)</span><br></br> + </div> </TabsContent> <TabsContent value="tab_term_winter"> @@ -433,34 +437,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe ref={ref} queryClick={filterData} /> - <div className="overflow-y-auto h-[550px]"> - <UiTable - headName={undefined} - tableData={copyYearList} - headlist={upHeadListModalYear} - pageSize={0} - total={0} - cellClick={undefined} - onPageChange={() => {}} - className="h-[500px]" - boldArray={[0,1,2]} - > - <HeadMakeColSpan upHeadList={upHeadListModalYear} layoutNum={3} /> - </UiTable> - </div> - </TabsContent> - - <TabsContent value="tab_term_chuncheon"> - <FacilityTermModalHeader<FacilityWaterQltyProps> - searchList={facilityWaterQltyYearList} - fcltyCd={facilityCd} - fcltyName={fcltyName} - tabName="tab_term_chuncheon" - searchYear={searchYear} - ref={ref} - queryClick={filterData} - /> - <div className="overflow-y-auto h-[550px]"> + <div className="overflow-y-auto h-[500px]"> <UiTable headName={undefined} tableData={copyYearList} @@ -476,6 +453,39 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe </UiTable> </div> <div className="mt-14"> + <span className="text-2xl font-bold text-gray-500">☞ 미처리하수량 =[(강우시 일별유입유량*강우시 일별유입BOD)-(청천시 연평균유입유량*청천시 연평균유입BOD)]​/강우시 일별유입BOD)​</span><br></br> + <span className="text-2xl font-bold text-gray-500">☞ 음수값 발생시 제외(null, 평균값 산정시 제외)</span><br></br> + </div> + </TabsContent> + + <TabsContent value="tab_term_chuncheon"> + <FacilityTermModalHeader<FacilityWaterQltyProps> + searchList={facilityWaterQltyYearList} + fcltyCd={facilityCd} + fcltyName={fcltyName} + tabName="tab_term_chuncheon" + searchYear={searchYear} + ref={ref} + queryClick={filterData} + /> + <div className="overflow-y-auto h-[500px]"> + <UiTable + headName={undefined} + tableData={copyYearList} + headlist={upHeadListModalYear} + pageSize={0} + total={0} + cellClick={undefined} + onPageChange={() => {}} + className="h-[500px]" + boldArray={[0,1,2]} + > + <HeadMakeColSpan upHeadList={upHeadListModalYear} layoutNum={3} /> + </UiTable> + </div> + <div className="mt-14"> + <span className="text-2xl font-bold text-gray-500">☞ 미처리하수량 =[(강우시 일별유입유량*강우시 일별유입BOD)-(청천시 연평균유입유량*청천시 연평균유입BOD)]​/강우시 일별유입BOD)​</span><br></br> + <span className="text-2xl font-bold text-gray-500">☞ 음수값 발생시 제외(null, 평균값 산정시 제외)</span><br></br> <span className="text-2xl font-bold text-gray-500">☞ 청천시 : 강우량이 3mm미만의 날</span> </div> </TabsContent> @@ -490,7 +500,7 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe ref={ref} queryClick={filterData} /> - <div className="overflow-y-auto h-[550px]"> + <div className="overflow-y-auto h-[500px]"> <UiTable headName={undefined} tableData={copyYearList} @@ -506,6 +516,8 @@ export default function WaterQualityModal({fcltyName='', facilityCd='', searchYe </UiTable> </div> <div className="mt-14"> + <span className="text-2xl font-bold text-gray-500">☞ 미처리하수량 =[(강우시 일별유입유량*강우시 일별유입BOD)-(청천시 연평균유입유량*청천시 연평균유입BOD)]​/강우시 일별유입BOD)​</span><br></br> + <span className="text-2xl font-bold text-gray-500">☞ 음수값 발생시 제외(null, 평균값 산정시 제외)</span><br></br> <span className="text-2xl font-bold text-gray-500">☞ 강우량 3mm 이상만 날과 강우영향일(강우일+2일)의 날</span> </div> </TabsContent> diff --git a/apps/fo/app/pages/(with-layout)/flowRate/modal/page.tsx b/apps/fo/app/pages/(with-layout)/flowRate/modal/page.tsx index b38aea419..5a38ad8f0 100644 --- a/apps/fo/app/pages/(with-layout)/flowRate/modal/page.tsx +++ b/apps/fo/app/pages/(with-layout)/flowRate/modal/page.tsx @@ -225,6 +225,10 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st boldArray={[0,1,2]} /> </div> + <div className="mt-14"> + <span className="text-2xl font-bold text-gray-500">☞ 미처리하수량 =[(강우시 일별유입유량*강우시 일별유입BOD)-(청천시 연평균유입유량*청천시 연평균유입BOD)]​/강우시 일별유입BOD)​</span><br></br> + <span className="text-2xl font-bold text-gray-500">☞ 음수값 발생시 제외(null, 평균값 산정시 제외)</span><br></br> + </div> </TabsContent> <TabsContent value="tab_term_summer"> <FacilityTermModalHeader<FlowRateModalInterface> @@ -249,6 +253,10 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st boldArray={[0,1,2]} /> </div> + <div className="mt-14"> + <span className="text-2xl font-bold text-gray-500">☞ 미처리하수량 =[(강우시 일별유입유량*강우시 일별유입BOD)-(청천시 연평균유입유량*청천시 연평균유입BOD)]​/강우시 일별유입BOD)​</span><br></br> + <span className="text-2xl font-bold text-gray-500">☞ 음수값 발생시 제외(null, 평균값 산정시 제외)</span><br></br> + </div> </TabsContent> <TabsContent value="tab_term_winter"> <FacilityTermModalHeader<FlowRateModalInterface> @@ -273,6 +281,10 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st boldArray={[0,1,2]} /> </div> + <div className="mt-14"> + <span className="text-2xl font-bold text-gray-500">☞ 미처리하수량 =[(강우시 일별유입유량*강우시 일별유입BOD)-(청천시 연평균유입유량*청천시 연평균유입BOD)]​/강우시 일별유입BOD)​</span><br></br> + <span className="text-2xl font-bold text-gray-500">☞ 음수값 발생시 제외(null, 평균값 산정시 제외)</span><br></br> + </div> </TabsContent> <TabsContent value="tab_term_chuncheon"> <FacilityTermModalHeader<FlowRateModalInterface> @@ -298,6 +310,8 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st /> </div> <div className="mt-14"> + <span className="text-2xl font-bold text-gray-500">☞ 미처리하수량 =[(강우시 일별유입유량*강우시 일별유입BOD)-(청천시 연평균유입유량*청천시 연평균유입BOD)]​/강우시 일별유입BOD)​</span><br></br> + <span className="text-2xl font-bold text-gray-500">☞ 음수값 발생시 제외(null, 평균값 산정시 제외)</span><br></br> <span className="text-2xl font-bold text-gray-500">☞ 청천시 : 강우량이 3mm미만의 날</span> </div> </TabsContent> @@ -315,6 +329,8 @@ export default function FlowRateModal(props: { fcltyName: string; facilityCd: st <UiTable headName="유량현황" tableData={copyYearList} headlist={upHeadListFlowRateModalYear} pageSize={0} total={0} cellClick={undefined} onPageChange={() => {}} className="h-[370px]" boldArray={[0,1,2]}/> </div> <div className="mt-14"> + <span className="text-2xl font-bold text-gray-500">☞ 미처리하수량 =[(강우시 일별유입유량*강우시 일별유입BOD)-(청천시 연평균유입유량*청천시 연평균유입BOD)]​/강우시 일별유입BOD)​</span><br></br> + <span className="text-2xl font-bold text-gray-500">☞ 음수값 발생시 제외(null, 평균값 산정시 제외)</span><br></br> <span className="text-2xl font-bold text-gray-500">☞ 강우량 3mm 이상만 날과 강우영향일(강우일+2일)의 날</span> </div> </TabsContent> From b92baf8b2a09f04696fa3ed1bbc8fd06109d9d04 Mon Sep 17 00:00:00 2001 From: jsyang <mind-one003@mind-one.co.kr> Date: Wed, 3 Sep 2025 14:02:59 +0900 Subject: [PATCH 33/35] =?UTF-8?q?=ED=8C=9D=EC=97=85=20=EC=97=91=EC=85=80?= =?UTF-8?q?=20=EB=8B=A4=EC=9A=B4=EB=A1=9C=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../facilityPrecipitation/modal/page.tsx | 32 ++++++- .../processFacility/modal/page.tsx | 88 +++++++++++++++++- .../(with-layout)/sewageOccur/modal/page.tsx | 32 ++++++- .../underWaterInput/modal/page.tsx | 30 +++++- apps/fo/app/store/common/index.tsx | 2 +- apps/fo/app/store/processFacility/index.tsx | 4 +- apps/fo/app/store/underWaterInput/index.tsx | 8 +- apps/fo/public/dashBoadModalWaterQlty.xlsx | Bin 0 -> 10478 bytes 8 files changed, 174 insertions(+), 22 deletions(-) create mode 100644 apps/fo/public/dashBoadModalWaterQlty.xlsx diff --git a/apps/fo/app/pages/(with-layout)/facilityPrecipitation/modal/page.tsx b/apps/fo/app/pages/(with-layout)/facilityPrecipitation/modal/page.tsx index 0b4ef5830..bb430d0ba 100644 --- a/apps/fo/app/pages/(with-layout)/facilityPrecipitation/modal/page.tsx +++ b/apps/fo/app/pages/(with-layout)/facilityPrecipitation/modal/page.tsx @@ -1,10 +1,11 @@ "use client" import CalcRainEffect from "@/app/components/common/CalcRainEffect"; +import { roundNumber } from "@/app/components/common/DataForm"; import { useFoStore } from "@/app/store"; import type { PrecipitationPropsDetailProps } from "@/app/store/facilityPrecipitation"; -import { DatePickerRange, UiTable } from "@common/business_components/ui"; +import { DatePickerRange, downloadExcel, UiTable } from "@common/business_components/ui"; import ListDiv from "@common/business_components/ui/list_div"; -import { Table, TableCell, TableHead, TableRow } from "@common/components/ui"; +import { Button, Table, TableCell, TableHead, TableRow } from "@common/components/ui"; import { useEffect, useRef, useState } from "react"; type PrecipitationModalProps = { @@ -20,9 +21,9 @@ type DateRange = { } export default function PrecipitationModal(props: PrecipitationModalProps) { - const { PrecipitationDetail } = useFoStore((state) => state); + const { Common, PrecipitationDetail } = useFoStore((state) => state); const { upHeadListPrecipitationDetail } = PrecipitationDetail; - + const { btnClass } = Common; // Refs const startPickerRef = useRef<HTMLDivElement>(null); const endPickerRef = useRef<HTMLDivElement>(null); @@ -146,6 +147,26 @@ export default function PrecipitationModal(props: PrecipitationModalProps) { } }, [props.detailList, props.facilityCd]); + const excelDownload = () => { + const totData = getTableData(); + const excelDownList: any[] = []; + if(totData.length > 0){ + totData.forEach((item) => { + excelDownList.push({ + "날짜": item.rainDt, + "강수량(mm/일)": roundNumber(item.infoRnDay, 1), + "강우일(일)": roundNumber(item.rainDay, 0), + "강우영향일(일)": roundNumber(item.rainEffectDay, 0), + }); + }); + } + if (excelDownList && excelDownList.length > 0) { + downloadExcel({ data: JSON.parse(JSON.stringify(excelDownList)), fileName: props.searchYear+'년 '+props.fcltyName + ' 강수현황', sheetNameArray: ['지하수유입량'], headerRange: 'A1:D1' }); + } else if (totData.length == 0) { + alert('다운받을 데이터가 없습니다.'); + } + } + return ( <> <ListDiv className="!mt-5 !h-[80px]"> @@ -187,6 +208,9 @@ export default function PrecipitationModal(props: PrecipitationModalProps) { </div> </ListDiv> <ListDiv className="h-[550px] overflow-y-auto"> + <Button className={btnClass} style={{float: 'right'}} color="green" onClick={excelDownload}> + {"엑셀다운로드"} + </Button> <UiTable headName={"강수현황"} tableData={getTableData()} diff --git a/apps/fo/app/pages/(with-layout)/processFacility/modal/page.tsx b/apps/fo/app/pages/(with-layout)/processFacility/modal/page.tsx index 5764cb5ae..29e2ca382 100644 --- a/apps/fo/app/pages/(with-layout)/processFacility/modal/page.tsx +++ b/apps/fo/app/pages/(with-layout)/processFacility/modal/page.tsx @@ -1,12 +1,13 @@ "use client" +import { roundNumber } from "@/app/components/common/DataForm"; import { useFoStore } from "@/app/store"; import type { TableUpperProps } from "@/app/store/dashboard"; -import { UITab, UiTable } from "@common/business_components/ui"; +import { downloadExcel, filePickedBlobArray, UITab, UiTable } from "@common/business_components/ui"; import ListDiv from "@common/business_components/ui/list_div"; import { TabsContent } from "@common/components"; -import { Table, TableCell, TableHead, TableRow } from "@common/components/ui"; +import { Button, Table, TableCell, TableHead, TableRow } from "@common/components/ui"; type ModalType = { fcltyName: string; @@ -82,8 +83,8 @@ const headMakeList = (upHeadList: TableUpperProps[], gridNum:number) => { export default function ProcessFacilityInfoModal(props: ModalType) { // 그리드 관련 - const {ProcessFacilityDetail} = useFoStore((state) => state); - + const {Common, ProcessFacilityDetail} = useFoStore((state) => state); + const { btnClass } = Common; const { upHeadListPlanInfo, gridListPlanInfo, @@ -115,6 +116,79 @@ export default function ProcessFacilityInfoModal(props: ModalType) { const upHeadListPlanInfoChange = headMakeList(upHeadListPlanInfo, 2); const upHeadListFcltyHistInfoChange = headMakeList(upHeadListFcltyHistInfo, 3); const upHeadListFcltyWaterQltyInfoChange = headMakeList(upHeadListFcltyWaterQltyInfo, 4); + + const excelDownloadPlan = () => { + const excelDownList: any[] = []; + console.log('gridListFcltyHistInfo : ' , gridListFcltyHistInfo) + + if(gridListFcltyHistInfo.length > 0){ + gridListFcltyHistInfo.forEach((item) => { + excelDownList.push({ + "차수": item.extnsSeqno, + "구분": item.extnsNm, + "사업시작일": item.bzStrtYrMnth, + "사업종료일": item.bzEdYrMnth, + "설치인가일": item.eqpPrmsDt, + "준공일": item.cmplDt, + "시운전완료일": item.trlrnCmplDt, + "가동개시일": item.rnDt, + "시설용량(m³/일)": roundNumber(item.fctCpc,0), + }); + }); + } + if (excelDownList && excelDownList.length > 0) { + downloadExcel({ data: JSON.parse(JSON.stringify(excelDownList)), fileName: props.fcltyName + ' 시설이력관리', sheetNameArray: [props.fcltyName + ' 시설이력관리'], headerRange: 'A1:I1' }); + } else if (gridListFcltyHistInfo.length == 0) { + alert('다운받을 데이터가 없습니다.'); + } + } + + const excelDownloadQlty = () => { + fetch(`/dashBoadModalWaterQlty.xlsx`, {}).then(async (response) => { + if (!response.ok) { + throw Error(response.statusText); + } + + // 받은 파일 바인너리 처리 + const blobRet = await response.arrayBuffer(); + const excelData = gridListFcltyWaterQltyInfo.map((item) => { + return [ + item.extnsSeqno, + item.plInflWqltBod, + item.plInflWqltToc, + item.plInflWqltCod, + item.plInflWqltSs, + item.plInflWqltTn, + item.plInflWqltTp, + item.dsInflWqltBod, + item.dsInflWqltToc, + item.dsInflWqltCod, + item.dsInflWqltSs, + item.dsInflWqltTn, + item.dsInflWqltTp, + item.plEfflWqltBod, + item.plEfflWqltToc, + item.plEfflWqltCod, + item.plEfflWqltSs, + item.plEfflWqltTn, + item.plEfflWqltTp, + ]; + }); + + const sheetParameter = [ + { + data: excelData, + headerNum: 2, + headerRange: 'A1:S2', + sheetName: '시설 수질정보', + startCol: 'A' + }, + ]; + // 버퍼에 있는 엑셀데이터 전달 후 json으로 변환 + await filePickedBlobArray(blobRet, props.fcltyName +' 수질정보', sheetParameter); + }); + } + return ( <> <ListDiv className="!h-[80px]"> @@ -185,6 +259,9 @@ export default function ProcessFacilityInfoModal(props: ModalType) { <TabsContent value="history_info"> <ListDiv> <div className="h-[250px] w-full overflow-y-auto overflow-x-hidden"> + <Button className={btnClass} style={{float: 'right'}} color="green" onClick={excelDownloadPlan}> + {"엑셀다운로드"} + </Button> <div className="h-[120%]"> <UiTable headName={"시설 이력관리"} tableData={gridListFcltyHistInfo} headlist={upHeadListFcltyHistInfo} pageSize={0} total={0} cellClick={undefined} onPageChange={()=>{}}> {upHeadListFcltyHistInfoChange} @@ -194,6 +271,9 @@ export default function ProcessFacilityInfoModal(props: ModalType) { </ListDiv> <ListDiv> <div className="h-[250px] w-full overflow-y-auto overflow-x-hidden"> + <Button className={btnClass} style={{float: 'right'}} color="green" onClick={excelDownloadQlty}> + {"엑셀다운로드"} + </Button> <div className="h-[120%]"> <UiTable headName={"시설 수질정보"} tableData={gridListFcltyWaterQltyInfo} headlist={upHeadListFcltyWaterQltyInfo} pageSize={0} total={0} cellClick={undefined} onPageChange={()=>{}}> {upHeadListFcltyWaterQltyInfoChange} diff --git a/apps/fo/app/pages/(with-layout)/sewageOccur/modal/page.tsx b/apps/fo/app/pages/(with-layout)/sewageOccur/modal/page.tsx index 4081b4547..37cadc7c6 100644 --- a/apps/fo/app/pages/(with-layout)/sewageOccur/modal/page.tsx +++ b/apps/fo/app/pages/(with-layout)/sewageOccur/modal/page.tsx @@ -1,15 +1,17 @@ "use client" +import { roundNumber } from "@/app/components/common/DataForm"; import { useFoStore } from "@/app/store"; import type { modalTableType } from "@/app/store/sewageOccur"; -import { DateMonthPicker, UiTable } from "@common/business_components/ui"; +import { DateMonthPicker, downloadExcel, UiTable } from "@common/business_components/ui"; import ListDiv from "@common/business_components/ui/list_div"; -import { Table, TableCell, TableHead, TableRow } from "@common/components/ui"; +import { Button, Table, TableCell, TableHead, TableRow } from "@common/components/ui"; import { useEffect, useState } from "react"; export default function SewageOccurModal(props: { fcltyName: string; facilityCd : string; searchYear : string}) { // 그리드 관련 - const {SewageOccurDetail, searchSewageOccurDetailList} = useFoStore((state) => state); - + const { Common, SewageOccurDetail, searchSewageOccurDetailList} = useFoStore((state) => state); + const { btnClass } = Common; + // searchYear 유효성 검사 및 기본값 설정 const validSearchYear = props.searchYear && /^\d{4}$/.test(props.searchYear) ? props.searchYear : new Date().getFullYear().toString(); @@ -61,6 +63,25 @@ export default function SewageOccurModal(props: { fcltyName: string; facilityCd } }, [endYearMonth, startYearMonth]); + const excelDownload = () => { + const excelDownList: any[] = []; + if(detailList.length > 0){ + detailList.forEach((item) => { + excelDownList.push({ + "날짜": item.msrDt, + "물사용량(m³/일)": roundNumber(item.waterUsage, 0), + "오수전환율(%)": roundNumber(item.swageChangePercent, 0), + "오수발생량 추정(m³/일)": roundNumber(item.estimationSewage, 0), + }); + }); + } + if (excelDownList && excelDownList.length > 0) { + downloadExcel({ data: JSON.parse(JSON.stringify(excelDownList)), fileName: props.searchYear+'년 '+props.fcltyName + ' 오수발생량 추정', sheetNameArray: [props.fcltyName + ' 오수발생량 추정'], headerRange: 'A1:D1' }); + } else if (detailList.length == 0) { + alert('다운받을 데이터가 없습니다.'); + } + } + return ( <> <ListDiv className="!h-[80px] !mt-10"> @@ -118,6 +139,9 @@ export default function SewageOccurModal(props: { fcltyName: string; facilityCd </ListDiv> <ListDiv className="!h-[570px] overflow-y-auto"> <div className="h-[120%]"> + <Button className={btnClass} style={{float: 'right'}} color="green" onClick={excelDownload}> + {"엑셀다운로드"} + </Button> <UiTable headName={"오수발생량 추정"} tableData={detailList} headlist={upHeadListSewageOccurDetail} pageSize={0} total={0} cellClick={undefined} onPageChange={() => {}} boldArray={[0, 1, 2]}> </UiTable> </div> diff --git a/apps/fo/app/pages/(with-layout)/underWaterInput/modal/page.tsx b/apps/fo/app/pages/(with-layout)/underWaterInput/modal/page.tsx index 79c35b251..1d4ea2310 100644 --- a/apps/fo/app/pages/(with-layout)/underWaterInput/modal/page.tsx +++ b/apps/fo/app/pages/(with-layout)/underWaterInput/modal/page.tsx @@ -1,9 +1,11 @@ "use client" +import { roundNumber } from "@/app/components/common/DataForm"; import { useFoStore } from "@/app/store"; import type { UnderWaterInputModalProps } from "@/app/store/underWaterInput/types"; +import { downloadExcel } from "@common/business_components"; import { DateMonthPicker, UITab, UiTable } from "@common/business_components/ui"; import ListDiv from "@common/business_components/ui/list_div"; -import { Table, TableCell, TableHead, TableRow, TabsContent } from "@common/components/ui"; +import { Button, Table, TableCell, TableHead, TableRow, TabsContent } from "@common/components/ui"; import { useEffect, useState } from "react"; type ModalProps ={ @@ -20,8 +22,8 @@ const tabList1 = [ export default function UnderWaterInputModal({fcltyCd='', fcltyName='',searchYear=new Date().getFullYear().toString()} : ModalProps) { // 그리드 관련 - const {UnderWaterDetail, unserWaterModal} = useFoStore((state) => state); - + const {Common, UnderWaterDetail, unserWaterModal} = useFoStore((state) => state); + const { btnClass } = Common; const [startYmDate, setStartYmDate] = useState<string>(searchYear+'01'); const [endYmDate, setEndYmDate] = useState<string>(searchYear+'12'); const [tabTerm, setTabTerm] = useState<string>('tab_term_year'); @@ -87,9 +89,31 @@ export default function UnderWaterInputModal({fcltyCd='', fcltyName='',searchYea unserWaterModal(fcltyCd, searchYear, prevStartYmDate, prevEndYmDate); } , [fcltyCd, searchYear, unserWaterModal, prevStartYmDate, prevEndYmDate]); + const excelDownload = () => { + const excelDownList: any[] = []; + if(copyYearList.length > 0){ + copyYearList.forEach((item) => { + excelDownList.push({ + "날짜": item.msrDt, + "청천시 실제 하수유입량(m³/일)": roundNumber(item.realSewageInput, 0), + "오수발생량(m³/일)": roundNumber(item.sewageOccur, 0), + "지하수 유입량(m³/일)": roundNumber(item.underWaterInput, 0), + }); + }); + } + if (excelDownList && excelDownList.length > 0) { + downloadExcel({ data: JSON.parse(JSON.stringify(excelDownList)), fileName: searchYear+'년 '+fcltyName + ' 지하수유입량', sheetNameArray: [fcltyName + ' 지하수유입량'], headerRange: 'A1:D1' }); + } else if (copyYearList.length == 0) { + alert('다운받을 데이터가 없습니다.'); + } + } + return ( <> <UITab tabList={tabList1} defaultValue="tab_term_year" onValueChange={(val) => {setTabTerm(val)}}> + <Button className={btnClass} style={{float: 'right'}} color="green" onClick={excelDownload}> + {"엑셀다운로드"} + </Button> <TabsContent value="tab_term_year"> <ListDiv className="!h-[100px]"> <div className="card !m-[1.2rem] max-h-[40rem] overflow-auto !p-0r"> diff --git a/apps/fo/app/store/common/index.tsx b/apps/fo/app/store/common/index.tsx index bff960099..1c9b06991 100644 --- a/apps/fo/app/store/common/index.tsx +++ b/apps/fo/app/store/common/index.tsx @@ -420,7 +420,7 @@ export const commonState: CommonType = { selectFlowTerm: selectFlowTerm, selectFlowPanel: selectFlowPanel, selectEnvPartData: selectEnvPartData, - btnClass: "p-4 m-2 text-white rounded-sm text-lg font-medium", + btnClass: "p-4 m-2 !mr-10 text-white rounded-sm text-lg font-medium", }, auth: { diff --git a/apps/fo/app/store/processFacility/index.tsx b/apps/fo/app/store/processFacility/index.tsx index da6589001..ecb668063 100644 --- a/apps/fo/app/store/processFacility/index.tsx +++ b/apps/fo/app/store/processFacility/index.tsx @@ -118,7 +118,7 @@ export type fcltyHistInfoProps = { sitArea : number, trtDstrArea : number, swrTrtPopl : number, - fcltCpc : number | '' + fctCpc : number | '' } // 시설 수질정보 @@ -345,7 +345,7 @@ const gridListFcltyHistInfo:fcltyHistInfoProps[] = [ sitArea : 0, trtDstrArea : 0, swrTrtPopl : 0, - fcltCpc : 860000 + fctCpc : 860000 } ]; diff --git a/apps/fo/app/store/underWaterInput/index.tsx b/apps/fo/app/store/underWaterInput/index.tsx index 4562509c1..d3ca9ea98 100644 --- a/apps/fo/app/store/underWaterInput/index.tsx +++ b/apps/fo/app/store/underWaterInput/index.tsx @@ -307,16 +307,16 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy sumWinterChungcunFlow += flowItem.inflAmnt && flowItem.inflAmnt !== 'x' ? Number(flowItem.inflAmnt.toString().trim()) : 0; } }); - const usage = chungcunSumFlow / calData.length; - const summerUsage = sumSummerChungcunFlow / sumSummerChungcunDay; - const winterUsage = sumWinterChungcunFlow / sumWinterChungcunDay; + const usage = chungcunSumFlow&&chungcunSumFlow>0?chungcunSumFlow / calData.length:0; + const summerUsage = sumSummerChungcunFlow?sumSummerChungcunFlow / sumSummerChungcunDay:0; + const winterUsage = sumWinterChungcunFlow?sumWinterChungcunFlow / sumWinterChungcunDay:0; //bscFctCd === '11200PB001R') 중랑 - 테스트할 때 코드넣고 해야 보기편해요~ /* if(bscFctCd === '11200PB001R') { console.log('calData.length : ', calData.length); console.log('usage : ', usage, 'summerUsage : ', summerUsage, 'winterUsage : ', winterUsage); } */ - + console.log(item.bscFctCd+'. '+' '+sumSummerChungcunFlow+' '+sumSummerChungcunDay+' '+summerUsage); item.underWaterInputYear = Math.round((usage-(usage*0.65*OSU_PERCENT)) * 1) / 1; item.underWaterInputSummer = Math.round((summerUsage-(summerUsage*0.65*OSU_PERCENT)) * 1) / 1; item.underWaterInputWinter = Math.round((winterUsage-(winterUsage*0.65*OSU_PERCENT)) * 1) / 1; diff --git a/apps/fo/public/dashBoadModalWaterQlty.xlsx b/apps/fo/public/dashBoadModalWaterQlty.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..dc555a880fa5d1fb3bdbe7b18b85359b9a790f99 GIT binary patch literal 10478 zcmeHtWmFv767CR4a39<?*x*4jxVyW%!w}rv32s4yhv4oKB*B8a1xO$vxI5%ca__l0 zhjZRr@Bh7f*6QxPx~rylb$zvKf3=llVc~#)CjbNh06+l{<_;QjfB^vD9s>Z_0E9=n zq7Vlca|ahgHBU!#XMJW5dpq)cxJPukfJe~h|JVMDEl{pD=+MK8(V@95DAuVFnHOGK zia^{-tV_KG|H>m#i@I@>fbQ1!sfDt74MI1KvfY?2?Fk=##Uib?h|m{1=4)+5Y9r(~ zF%?cn{C85X#e)jVHDc=Gqo3vCqaGYQnQDNSYhE;AwxRq%NrU^W9*N^y_p!ovk+KLu zQJM~huceQ!=6Co9d$b?P(!1iD@OT8PfCyziX|}g3vvX)rS7kbrs52*D#Lxq4lv?Vq z$)vZ3CV{#7HC6=AMahJ$%VA3F*~w5i!VocP*nr36mH|&#s8(8sn%R+h7d?E8b|mpz zv%gd}x*FbsgC^o%s^==s)VjCWY{Vg-q&uJNat;(#M1qEN%y$(o5br(k&3(=wOob<S zfn!_bIc)Jqo*f|w&S4nVD}Ya}dzh!h&J~Zg5RXnZxbY70Zj#Yrr+IkdvK9ep?#6ft zmCw&m-~v&0MV+kX&tDQ>l`WyIWakT$t)(8J5#2*^_TvXEK<O_qZBS>WI)(b49P}<S z6sCqw=6233%s-F+gXe!SCjT__@<e&XURIQ_1F75afs2`ycnlF)cVVeE3N^m~>1FhW zm;!2|m9D467;1#Uu#)~Aez!wQD||8A0~F_<Im@H5fMBXd_lmHz>ld!@475(E5--Zv z`!L;R&SuWjC1pJ6+&bbI%9=~^WCvHNB&LqUYB0u_H3<>1i-^N;`O^b+KFDi-GP$gT znGsRls|c%Z;?CVp8q4&bOD+D6Dj2~lw>z1RGvI7uxlrjdU`KIwMX0W7#cN${lH>H8 z($mn)?%j!4W*7FI4@e<vK!uVM>ymv;vY#gR%wMOT^JqBRvyU6Gw`|~WFesX=<P&tp z`a4Jh1(MTFpcZL`f`kx&0OMiD@-LjYL!4|)AQ0Q1v)Lb*fq_nGP%Z!6tz1Q3whtQ8 zk?+G<-80>AFc(}{D0kI&&=Cgf>6d6JIQ&jmi5Ob-wPs~mU?E|i2P6G%7thc>!(yLx zGnPbQ!FgfZ9e^K0Movax5lr?fNP{FFV`J@Z@09H!qh&Z_w+JK-Fy#PwzFyMN5QG;L zQ;MCoOonmVjIz42+c=Mt3_*QnxPBwxIz)B1BB;Kpi9CbeV)I9f=+gO<*Fm0S6DI_S z(tN0%fQhYX3dYNB@pFXZ_FD^i&r#d%f@_pb;xbv%(r5fWVJ_t11CnI^^oh=!`RQ%y z2kR~(H$(JYOUF#Zrw0}rgZ(qB&@cUWmm#Kdn}>r10Op<m0O-&spf2-gXDL@-ahPHS zc1nIGp<K0WoZ_@EFfY;NU_%^-Lt#$HY>v@3fnU-F%eO6&e143P)(!&+{Q!2%;sO<L zn^M`_B^CJGkMgeae)4ZDmpKTsrAn5=SfLvD!mip9e*%}?!G9h;z>zwbl_GNtr|%S; zL&E1<+og2vQ##!O516DbscwvA<I?VCv^ZBAq0zFC(frt>F;?^TnPm$-Pm_8itO%tZ z8^r_?#q345QeFDMrI@+=`y%~7D+6}qQ+W!TsXX-s-!+EfvCPFWHFelNwd5Xy#@vCj z+DkL$6pJaWWrNAirs>1zHAO@eVRx)oZn33e#VN`hZSdnB;$Hp!GOR`JBGt<=-FNXK z<yWDOyvx;-6R_IiMCDe<5`zU3bW&wAGAP~N<U0PnAR+i04&`Ha#_wL`m4-D#=A~i= zgD>TsjXiU6VeDptAcg^&t#8qZl!H<x15`rLxts)MssoqfWQQBfQpxD8g>7uN<5JY4 zebwkNYA!PTZ9={(fypTx;U!Yv+u10jgW4t15PK}2-1d@%a?0ql^Y*92^8zVx^K%IK zra*1P!8g^a%?`yy1BYabW^JK|=-X!L$Y@~!<x*9%{_yb4JI$(VZ)Zr$6=_+>ks<Ss zH{jS`SIM6DJ?^*=ws>AlRykQBNhhu9&%TTK`ekp8AX?nh`$H?vsQhjZIaMdr(Ji`B zpsihvLQ}AU5<<%gTZh^3sEG7(gpcf(sB*H^5r5R|y+z(#!X<Dwo&_UH(^=|){v}?8 zWZH@sMxcN6?4iL%qm)t{-1^rQXXdYutBZQq$5R5(h|Azsj5)Mxc*FYLdr7!1(VyGj z!0GJm4r&}Xz3y81<n!a|%h$O%mhlSxU{~WXv?5dYM1euwm@oTZUZyO(Jzt*wN`)j* z|Lyjx>`l+S+Y=Zha%oX^(s<>qr24sw-gUaeaATIkxE|^FbNKJn{JU)^EwbeIWEIsF z!Od;@#KS?>HyU-j#QTMFK5hdjQZ}0yhmXbG%3oZ}bVL3TFg_||lN8XnNdt|sz<&Y8 z*~-|-+)UNQ$=bov`DchNOz4*B6~YKR2s)_#D2={X%o{Oafh++hY?pTiBT_4mo4D|5 zC89%f>%BK7Cc4a-#$m<oHCp9tFtrCp+{xIj;ObcQy?R2Dtg`i6)&PS!SV~rn$Ue@1 zlcN`wWD#7Lw91uAaI83l*FN6S*7gx6`Do-E#eBJH{poa+E9yl;P3a}25ig0#lDBKI zl=C?#<Pua@PtL6{rQxv32;~8t=!FuV%F&Kgr+jO2vZE+XWtLz=RvR8hj(#IEzVZRF zJYH#HHVh6B34W>4x;tiW)`a2(?fRbUxu3V`0qO2tLv-!%l|sVg)JoMyGWYP{f?`h6 z5P5n#!x#yW;kR-SYGz_K|MNz}clYXU9bVdkARY4`S<)++SMdL6QdgK0;~Z!Vszd?+ zQ2%XG7f(C$U$&gqSc&?=1?*%wB?;Ll`O)XLYvi3S_o2Evv_~$lDGCJ6uLYW!J2nE( zac~#gaJ_1((Z`#%9ai%s8<RZdN4YpcLqE+=)|_S^WSx*`4@Ot6Z{?JxN++1Oe>D;l zr;w%H2Ku|F>0(M$(B@O?A!U4qwLgm9-Kk2{Amiy+Q7Od~ir{*$Tj4Id<PZ(AmjWk& z8P;TJ)I~Yv)a{$V;?fHl@~BPx{fK*Etby<$=Bj#+CNa)>{VZ{67cfV-UUK+u)v($` zZ4T>5iE|N`xK%15O}FG7E4_(T@Y;FmN2o!!FeEbum`hcEk91AHG9PQNl9d3s@|1Eg z0)Gmg2cOANuWFp;q#v&{y)7IEF>DxY0mmdoQ|qfH_}7&T@Rqbyq?mCgm1v|?Aee=D zy;0}~tA4k8sMjZPtAe+;(b{?mVMo1(6FcsZNSnMZ*jzj!UBhF{JYyw*X+3Is;AFb6 zS*H)L`&58>hxCh_@Ou-?D|Bl;dWlOx3GkDNE**rh7k)!kkYnU9CKw8vQZY1a&e#Jq z@IYli4uR7|)lJ$=110<%GV|)V%&1InerL|COKgIL1k9)%X8((gFlFHT`{lE{&XCL( zyx25*R_ULs$HMs$dy@~ahT>QQRLzWxcsb^{iEl#>m~P)8cNn}-%p2zj+<+7^tmi%- zS_*v!ubS$pV~vq&ayHxEu-xrT)evSenwXfNgVYm47YF_T^A0!pMA!M1uOa`teFo}t z`A=JE@e~LH16MpD(=U5rAg|02*UNEHamGp2tTkR0GaAW+$8Iqgv7T{zyyih8FL?u& z&_9EFg16?4FAob|r>b2#3Z7`;<qcbyVY4vJC^llm@kW)-q+UO&=aWEsg-?-jC^Y+; z>T%9!VJEeCLCi4Sz5lUWOR{i#5~<g?@Y5nH=g)60tD3s}d@i2&y)Mw1uo&aX!VY$m zch7MHSS)1UOt4wzb9J3{swx_gpV3qd<m|Lf^#fn`uZ}0~5si;GZ|l0TxS}U~KDkWc z<ys!U%+2<j=`lq9WL2dV<=?Ii`g|t8ubogA#pJI5%ZR37%XnC&x#LO-&T+n*+Hg7| ztHiz2N4Q=+O9O=?M-T>+46f$b)91)NxxO=mwNh;9H`vm9Txq)L+~05;FQx$;g=Iw7 zgOFU8Ws;-QE(cp02oo>4h7Z4_AY*!FOK166tIRaCSc48rP7pi9w>-qR)5^jh3fI3U z6JUFG*={I+MWFGK>R&+qnM^oanVY*f|2q}^)nWTjA{r9c9o54M6u*GI7xnN?nhiw} zRpq8^R{sWTa=rLuDJ}j2c;{V5Z2oR@({XH*EAxi$Es+IU0@HNsqtFdgJge$M??q6T za1GD)G7u5O7jHbp+?fHZpdb_3AFqXjTobBHeTU!c*SAm;i}*HP;Ol~Pq$lg(RW#9f zd8v*4u_1gti$cQz(}u5R@N<3@?fczWUot+2g04}i<FOEF-gqN{d@0@m@x9{!6X6~A z^Bh}WG`M2>kHaVDi2r1PkZr?wTc~YVp?C5BW`W;h&q|VqEd5-oz@C%Atza)GEEY** znOG^;HyK+u)iF)gU`V^rY!(omuS$YrRLRqF!$4Dsm+gg8V~~s4YS3lw1P&j`)2u*M zE$b$R%i)t=s}I@{lj@VX!9iWZYfaHrhF`&_JL3Q`2{=5YPkr-WMc`%vQjA}Mcy!)Q z=n{ONsuHu}A1HONl`xZb0+mn4k|DHog#@}*;4Bv`YB?SOj*QF-FGUNM91FEw5l3aZ zKGjo&HqwZ_jfsWuCv%h?zey2gkrnkkn0l*bckq35E1lT<`ig_5ETuodl^9!_*hE0_ zhr}|%+b5Hr_jtyWZx5?y^kEcBcAY7TG+`OR-L$Vm^wF#Ln|(Sb)VqJs9?V62vgW3K zv)+6j$MQ9$7|C6m4c)c7>&+GW7ZbLFn{R1h`j<v^bi*|GN|;hqo4e@w`V0#x%-IUO zJBtlsdhW4`^)wWr<6svg74eQxFl+JJMLoFvJi{z87au6ND0vp%+3oM4F$8e8^4nqH zqLvX<dEBu4$|EBy#xjX1y>MZs`V!kcE>}~YIt@~IPWJQTLciaSA0f%QXhEzPfGQEM zz^FA?)yxv|HCQzTp_h?{HcZ_+OFCsPw#$O-a&_s<fsrTQr~6!0o!z<w+HaCC`>>m? zDL1D2;t(t)#VwJ#47gM&sqH=ECQ>=Pe2ARwPa`kbe3rEEgFEB;FsLz@D5NL`I1!$k z_Mgu$<6G<^1wDf!LTJPQ?#~a9>h@595zaA)$xEIG4Bh#pQbVrh5`h}B>_yI~J)@ha z-3oeC)iLwWM3$uVOpS<S=kOOLwh5`02F6o~?X~kjw)N)0jdl~MkL>9uQb`tTC3VrP zWY4O^{S!}b&^>=qF29Cr7bon{BZMMeWpV`=57fXZkfR>THx~{~#+HjrdP(?!s=q#H z$~{+J``zdd(ESbbIW?%F<N$vDh@!Mtk}29BNhGGXsAiZz0dg5#Q}q?ipTo^Lu8T-l z|MIjH6g~Zd8nvxLs8@NeK{PnGUkr_^ipMVjCGd-OvX3kgi+u#_>GVbmdXgm^qCNMg zq3<HEF$A<yE=;!v=BU4M_S>0|^cq6My`<uODBt$b591*)1?GE=c!fubzlR?YAUc-O zp6gomsq;Z2Nk|p^HJ*n&k`Vgw^K9r^Cx-AR-TQ03<6>oQZ_e`T_$w~$YU@T5aRdEW zP6bg;_Aj}<3}Zp6``sEx9I$E?WJt|*&*{nt(i7T=upiOnjf>C&CnwWHR*#irU{N_w ziv%qw^5k#Gyb1}t3mdXV%vC27pD}S{C`!H_<-K+R`>(r+Ws7Dx_Iys&70`4dAW z)i;&u?K{rGsTYn6jKef%b7(>SxPrVy=I2OiABiD3A9&5SDgxpLnl!329b*Ei{9;EO zQC4Z0BI5(*%yfvKZXxVS)N9eF*t|zbn0GY+1}-orArcsWI~eQqxj%Gv_qOhk%!|}= z)Mm{e?5vN8VL$>4(8<CX9tO~kQsjg12np*7U^+p1;grm4qQjuKf=$i7oe_<-GHP}u zWivZvUF8NE#y(2Q_Ow&$rOIO`9Xj6ThA<^s{b$=9I#rFeZva-DK{>^GE}4FB7QSB- zXuuZ5;V!LsHR*62X54KPersg$e_{}*a`TC>a~1tv^v~;d$dPmhmdDRaAA3|omWDQi zm3NFvQqn%vVa!(zHr2a(NbJTg{Ya2&gD&Vo>Kolan7Z2_EiDsnrV~h{Nox{508WKk zYB%CNisCrJB#%%s3ijvSL~DddZc(-`N_wTq*F_AsX@ZLU^l`bMm-UN@c&zKT;)!v+ zl8EV%sW)s|uFnRho+`#3@C$Ta>>S<Q^k4XmE@~9N^a9i6Y@g)_-d<N72)f?iZiatD z@089Ii2U~aenHWY?`H1;FFl;}TcyYKUV&vC8UNjWnV_GKQOzfXaiwr{sgM?D0y5q? zEjW_;!~Wil85<N4v6qB&a7(yT{FsFAhLOeWo6)%RJ*Z$(YG7DKAq09Cy=Kf2MVqq5 zW`GO)0+LiM5=ZIAB2N$2xHsn?l3HTh!p8F|_5klC0=!QM1{iD7QAF&<+hvrQ#)17> zJjX=fck`2NnIZUoD^vv`FSsyA<v+V%)U=ujg-K9urnpJLz0jUV5Gg@j-Cc2f{&LZ4 z<$X9UR@mcw++$cdRBi(?=RnHLL71qL{X>0f5u(96arVg<{LJK&s&eU5M5d$mu9ei| zhM=u9A>&=+)q>~&G1?&FdAohe4=!eDBybc_78;|}Xs)}Gw*VC&uV#96_r)t-kqvMk z%zL6<-(VxE<u}OPt{9rxDmmoG!+bS;$CMUdJ@m#Adt}UoZcwG;q<l&{Un{x&SXFjw zlXx9iyoA~nnbCx8LZS+O%ISl>FIcjy&ly)`g3q+WG3UMR$FjWt!=RZvX0tABM=wvf z{iLB)r$v$oZy#Iad#9FC`|!+Sc5gf9zG&W}T1ob%4HY-?I@=O0ezSFu8p%`R&)Aeb zcNil^frc7O<Md;4iY*+b#Itv$T6+;kh)XsXta0b_JS$bH!%mQlD0oRq7M80rr+M25 zpnlmm@9GrKhO+F^j^o6D@*4)~`VVqg>d2ATwHWz_lvt&fmOc5_#uM>h)ADpAUTh-e zHbx;aWf5yRH0Z6$j=>nohSHG^^At%w8r~XO%d#%y=1tlr0F*_TKiNodkf|hUd+ME5 zyeKQSNS;@eDJ>$~ixKl8HT$}IQ2Rq`diZqiQ~erZRNfe`FZO*pQ3HtfxiytQPPbSc zhl=gq^?8I5oqf3TyF>gDa`$GvL(1o&Q*{YalQ2J?53$QOZ&8vKqiN<Rl?sc&DG<x# zr!uy64Lu=bL{(lM!odh}Pu0UV+tjCm7v>Ir`4pQE%WJ*?>-+ap9H77q(vGJ3-C1`n zZKi1RMek7pN8!l^VG!_S$Nc*{wspr_RfP^-TF0CgtXjSw3UYGkyW8+l4B?YbVwMy` z7C`-vs?AsvI3#C{$ARamX9UEp`#tMw3e^z4og4vm*)i+<^s)4?(gE!$=3)pWaZYP9 zsid1B#i7A|t!4IEnht!VO*V}}x~rjy$au+S48b(@7gvJRjO>(*=}|}FT+jT*Zb%t# z&vxWo_Ep}e!SWRBJ}3RRScWS;TkhC)9>{$K$Zy^`Gc+U7Eb~z#;QD^&bz&f56?2HT zi$PEv<)Z*yC=5cph2Nti6@{%bdZ<^aSzYeg<n7(eIE}HSwPp|LztR%JPq{mtEkcJ^ zc1c+2C^>GpNwe~tb#v&;r&PUQ6c^W9=}Km7yh#geH+(_zDBt;w#&_<r5rvBJ^2VFT zRZG^u4B-mZt=S;2rd8Bii8}u|S2Ub?TTR%iSzDmZCOMr)Lt^2o74Eh{(d7B|p2V2# z>PRZv_=%bTyJ3JgPSu|OKh9?9sm3=|Ka*`}%83Cbe9a)HN=^_*XBJ~e$A4EY|3~ve zEti!z=77zH@!>$Ky?5y1LuL>I&{IDTI1P)Fka#ZOVOfW3;BBs`iO5};L)Q-2OQ32p zxR#^ygl})-Tv1Y3{yO#s;zt_CW1voJJr2KT_u)f9GL2QraD%?ZuFui=8jkFvz>#jA zXaZeRqyFP74z`m@2}MFtERfxRmb9884|-`IQV(6D{Vs4+Q;6+Mc0Wplk?+NJt%&R` zt9%?!C4znIm2d}#S;v>cydTd-vTd$<-ka!48qpifHB2DUb*ki8Z|XZfrm@Ver@<TA z7?H`t^r6E}aE{%cwAC3_J2YnaiiD!@1wlIik?zt|IE%7=Co}L|I4X=5mBC2>@mf`H zjY3vH=p8PTDXIr*Dy0$QP7*VhD>(}{w_($3e}_s)li~j3xWvxoP|-8iS(eRa>^>vI zdBRh=ni}+$aWmF-7K^p-WFNm!IQNfZ|Hy0aT+zF`baijIyWc}Jzc}SNs6tfLoH3fK zsfqq%eZ!VDhwT0+1l@LpCCU?#^yCt|t>FOaGpECJ=B$}ckiN-%uIHlF*m{1KC$9iu z5zFLdS8&E!+#KkiSCx<Q*Qd0hPHqg%QZfJR<fafO^Z$7{)V=@RLK1})gIV#z4ruS; zC&BgA#(KS4`4&&pUPVlJ*e*g)LPZuCoG#X8qL0WfznxPtRZ~RMk}h5BO}#NB1Q|pv zdp;?uQyEP-z}yJfC>k((F3CMO$uAzuC5M!nhV``sCI<KDNV$)3NcOR2X}M53O1-JH zimJiL#D`Z=CgoR8kc#=2;<@zFN{v1+t4A?@Ak#+TA>V+*GkRqdwvM}{0gJg8AA~-z zExk!1<cPuxB#-&f`R&W=N*MJmL3EeF5^b~Mx4W5ct)`7@zC87YE?mH!*7I%YH^z6q zK25Fd`#IYdwb?lEK*=E0%7Ap0_vo$0>@kN{Wh929_1X*4RU8<W^6htCE1ka2m*OrE zekg#drVjGRi5bPb?|hxWyj@bMbZAl-t<)~T<P;RyVbiZyn$pO!AdhciOx_%_y!e_Z zEmEBPkq%L^kDq+M9bHiT7RpBco#mMG(7gmh1MV&w0PqxQdT7bS5la2Km^-POySV)1 zfFJhRm`$u5b~VRTr-Xoh_7j-5?_aNZ9IGr2u^2Ze7qc2K($WU5Z;3Q=ib}Cd+vpNQ zma~txR@b_N;rTo-b|<>}qW#*Wi$H4u)5`GfmUV3q_tl&8P46n}^hcjJRK=d>P`pom z1M(8W@p{=Rb%L*ppRLJ`-I8f&b#1UuWzNAV4RIJ-sihaaum)#}cV&;PYZtdTKhyK0 zNFv4b#g#u@Rhm_I9(bA0#YLvVeZt$ses<k!d}5ipUmX2t&x#jB@WuST?An&kG5uos zy+xgaJ;LGC^iX@Qx|nPvu99s1lg@86J2+x0q;=XV<Rhk<;`>9QwQvhe+mzQ>locq0 zd>tVYGsufarC%m8ET-k{r%KcYOEP3CBr<cbkELF^;2w^<pz+R>rm8<H8MP1B?g&V- zP9c(6P?ECke@h$6t-Tau-Mc!mKsqOq8E*FBW1Y5D67KWmXzkrg((f6@1m-hAFuO@e zIgRN%ef&0;>oCr5KesVQ^ID^}^e?|JZ3<V9OPWN}`&1M*3os+Sa?oW^cX7?r+Rcxg z^3%GoSJ<K05$E~Hq7axupI^aS^vPdSx3$vm`dY>x4hI6kASsA+3h~3bBdIs#L?@_x zH7jfjGHb`@bxcPp!Q4|pzB&xR|G=?DA|;Ye=4)f}4dtuA#^Y_H5h|iOv~%2es%VdB zMOKE-zIeGD$zYSKWuios#f9(=QkRHbTUmLA(I<c_Qc%D~dEYaGW$|jIHQX(hs5ZoQ zl$<sCbKmc?*dO2cb9~sd4QzqyGJISobj5t;>=Z2QhB42o;CCDKTJkF4Q2Wq?tceA+ zmxSY!%24zb<Kfj6dNL*2O|#^}(YF@1ZOcHg@WP{g=2!c%mpXFcFWfPZNj4(TZn>za zbo%bNX5P}aw1%Ltn0%C_dKx5%&n}Y)cr6XatbO<02@^~S8%aFfWQAtNk;f)=2JRB} zH?U|ynCNkA+mN8Vh@!kMh};0nzij)?v);pQ|4tQL_*qZL-byQ_brj$!FXr2oT*U3e z-i?lDkJs5UYW|q)=I+3kO<<5_ID$2{`NcZ{>@m@gHbywXasySG-%lh%S?bw-TwJH| zUy=NQKbS`#Xtm{^_iX(U{{A@s!wxPb*}p3I>u!=i1b?32K!N?Iy(JF?|5{=Hv*1T4 zsqlZVw?EYLu<ZI<(+}vjv<F4lhr$m_P``y)QGN;ktswPK!^4WpZw<lFkO%#H=l|4S z9*REXcz=t^VgBdM|6h#nLxm41)87geupTP>O`ty1@{rg0t>pmcmzIYt&qD=&O{IT} z0{|Vw0Kmh<`l0k+bCf?z=ac<O`j3p|q4>io<+lQM%3p8)|1-fT$v%eqAOL^@{n0|* KxR&N;@BaXvvK$=% literal 0 HcmV?d00001 From 50b5c66a7e38cf803c1580313d1cdab064183925 Mon Sep 17 00:00:00 2001 From: jsyang <mind-one003@mind-one.co.kr> Date: Wed, 3 Sep 2025 14:05:03 +0900 Subject: [PATCH 34/35] =?UTF-8?q?console.log=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/fo/app/pages/(with-layout)/dashboard/page.tsx | 1 - apps/fo/app/pages/(with-layout)/processFacility/modal/page.tsx | 1 - apps/fo/app/store/underWaterInput/index.tsx | 1 - 3 files changed, 3 deletions(-) diff --git a/apps/fo/app/pages/(with-layout)/dashboard/page.tsx b/apps/fo/app/pages/(with-layout)/dashboard/page.tsx index 31b7da073..2003addee 100644 --- a/apps/fo/app/pages/(with-layout)/dashboard/page.tsx +++ b/apps/fo/app/pages/(with-layout)/dashboard/page.tsx @@ -236,7 +236,6 @@ export default function DashBoard() { rowArray ) } - console.log(yearValueData); /* const excelData = [['날짜', '강수량', '유입하수량','시설용량', '유입BOD', '유입T-P', '총인유입T-P', '방류T-P'], */ const sheetParameter = [ diff --git a/apps/fo/app/pages/(with-layout)/processFacility/modal/page.tsx b/apps/fo/app/pages/(with-layout)/processFacility/modal/page.tsx index 29e2ca382..b27984df7 100644 --- a/apps/fo/app/pages/(with-layout)/processFacility/modal/page.tsx +++ b/apps/fo/app/pages/(with-layout)/processFacility/modal/page.tsx @@ -119,7 +119,6 @@ export default function ProcessFacilityInfoModal(props: ModalType) { const excelDownloadPlan = () => { const excelDownList: any[] = []; - console.log('gridListFcltyHistInfo : ' , gridListFcltyHistInfo) if(gridListFcltyHistInfo.length > 0){ gridListFcltyHistInfo.forEach((item) => { diff --git a/apps/fo/app/store/underWaterInput/index.tsx b/apps/fo/app/store/underWaterInput/index.tsx index d3ca9ea98..816860469 100644 --- a/apps/fo/app/store/underWaterInput/index.tsx +++ b/apps/fo/app/store/underWaterInput/index.tsx @@ -316,7 +316,6 @@ export const underWaterReducer:(set:(fn: (state: UnderWaterType) => UnderWaterTy console.log('calData.length : ', calData.length); console.log('usage : ', usage, 'summerUsage : ', summerUsage, 'winterUsage : ', winterUsage); } */ - console.log(item.bscFctCd+'. '+' '+sumSummerChungcunFlow+' '+sumSummerChungcunDay+' '+summerUsage); item.underWaterInputYear = Math.round((usage-(usage*0.65*OSU_PERCENT)) * 1) / 1; item.underWaterInputSummer = Math.round((summerUsage-(summerUsage*0.65*OSU_PERCENT)) * 1) / 1; item.underWaterInputWinter = Math.round((winterUsage-(winterUsage*0.65*OSU_PERCENT)) * 1) / 1; From 97072329549a6dbc44b971433e81395951da74a0 Mon Sep 17 00:00:00 2001 From: jsyang <mind-one003@mind-one.co.kr> Date: Wed, 3 Sep 2025 15:18:31 +0900 Subject: [PATCH 35/35] =?UTF-8?q?=EC=B4=9D=EC=9D=B8=EC=8B=9C=EC=84=A4=20?= =?UTF-8?q?=EC=9C=A0=EB=AC=B4=ED=99=95=EC=9D=B8=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20-=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20?= =?UTF-8?q?=EB=93=A4=EC=96=B4=EC=98=AC=20=EC=8B=9C=20=ED=99=95=EC=9D=B8?= =?UTF-8?q?=ED=95=84=EC=9A=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/fo/app/store/dashboard/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/fo/app/store/dashboard/index.tsx b/apps/fo/app/store/dashboard/index.tsx index 958346b74..f5861a21e 100644 --- a/apps/fo/app/store/dashboard/index.tsx +++ b/apps/fo/app/store/dashboard/index.tsx @@ -1798,7 +1798,7 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) operationalStatusList = rtnData; // 총인설비가 없을 경우 제외 - if(data.yearData.TP_INFL_WQLT_TP === null || data.yearData.TP_INFL_WQLT_TP === undefined || data.yearData.TP_INFL_WQLT_TP === 'null') { + if(!data.yearData.REAL_TP_EFFCTV || data.yearData.REAL_TP_EFFCTV === null) { operationalStatusList = operationalStatusList.slice(0, 11); } set((state: DashBoardType) => ({