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;