Compare commits
12
Commits
cdf3dfd18f
...
43af9042c8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
43af9042c8 | ||
|
|
e283c91394 | ||
|
|
63543a016e | ||
|
|
f96ae66385 | ||
|
|
8f531a245f | ||
|
|
ea738d687b | ||
|
|
8cc5a0a737 | ||
|
|
d4b32ffad0 | ||
|
|
911e97791d | ||
|
|
e0e1bb5b1a | ||
|
|
61aa2ff1e1 | ||
|
|
745a7d06ea |
@@ -755,37 +755,13 @@ const calcWaterQltyData = async (data: any[], searchYear: string | undefined, fc
|
||||
const orgData = data;
|
||||
const res = await fetchMainGraph(searchYear, fcltyCd);
|
||||
if (res.data.wqltObjs.length > 0) {
|
||||
const clone = (arr: any[]) => arr?.map(v => ({ ...v })) ?? [];
|
||||
// const clone = (arr: any[]) => arr?.map(v => ({ ...v })) ?? [];
|
||||
const qltyData = res.data.wqltObjs;
|
||||
// const qltyChungchunData = CalcRainEffect(clone(qltyData), 'SUNNY');
|
||||
|
||||
// 강우시 변수
|
||||
let rainSummerDay9 = 0, noNullRainSummerDay9 = 0;
|
||||
let rainInflBodAvg9 = 0, rainInflTnAvg9 = 0, rainInflTpAvg9 = 0;
|
||||
let rainEfflBodAvg9 = 0, rainEfflTnAvg9 = 0, rainEfflTpAvg9 = 0, rainTpInflAvg9 = 0;
|
||||
const qltyRainData = CalcRainEffect(clone(qltyData), 'RAIN');
|
||||
const rainEffectDayArray: string[] = [];
|
||||
// 강우시
|
||||
qltyRainData.forEach((item: any) => {
|
||||
const month = item.msrDt.substring(4, 6); // 월 추출
|
||||
if (month === '06' || month === '07' || month === '08') {
|
||||
rainSummerDay9 += 1;
|
||||
if (item.tpInflWqltTp != null && item.tpInflWqltTp != 0) {
|
||||
noNullRainSummerDay9 += 1;
|
||||
}
|
||||
|
||||
rainInflBodAvg9 += nullToZero(item.inflAssctBfrWqltBod);
|
||||
rainInflTnAvg9 += nullToZero(item.inflAssctBfrWqltTn);
|
||||
rainInflTpAvg9 += nullToZero(item.inflAssctBfrWqltTp);
|
||||
rainEfflBodAvg9 += nullToZero(item.efflWqltBod);
|
||||
rainEfflTnAvg9 += nullToZero(item.efflWqltTn);
|
||||
rainEfflTpAvg9 += nullToZero(item.efflWqltTp);
|
||||
rainTpInflAvg9 += nullToZero(item.tpInflWqltTp);
|
||||
}
|
||||
});
|
||||
console.log("99999999999999999");
|
||||
console.log(rainSummerDay9, noNullRainSummerDay9, rainInflBodAvg9, rainInflTnAvg9, rainInflTpAvg9, rainEfflBodAvg9, rainEfflTnAvg9, rainEfflTpAvg9, rainTpInflAvg9);
|
||||
|
||||
|
||||
// (0) 전체변수
|
||||
let summerDay = 0, noNullSummerDay = 0;
|
||||
let totalInflBodAvgSummer = 0, totalInflTnAvgSummer = 0, totalInflTpAvgSummer = 0;
|
||||
@@ -1013,8 +989,8 @@ const calcWaterQltyData = async (data: any[], searchYear: string | undefined, fc
|
||||
// 총인설비
|
||||
orgData[11].summerThree = qltyDataSetting(rainTpInflAvg, noNullRainSummerDay, 3);
|
||||
orgData[12].summerThree = qltyDataSetting(rainInflTpAvg, rainSummerDay, 3);
|
||||
console.log(rainEffectDayArray);
|
||||
console.log("000000000", rainSummerDay, noNullRainSummerDay, rainInflBodAvg, rainInflTnAvg, rainInflTpAvg, rainEfflBodAvg, rainEfflTnAvg, rainEfflTpAvg, rainTpInflAvg);
|
||||
// console.log(rainEffectDayArray);
|
||||
// console.log("000000000", rainSummerDay, noNullRainSummerDay, rainInflBodAvg, rainInflTnAvg, rainInflTpAvg, rainEfflBodAvg, rainEfflTnAvg, rainEfflTpAvg, rainTpInflAvg);
|
||||
|
||||
return orgData;
|
||||
} else {
|
||||
@@ -1250,40 +1226,25 @@ const calcValue = (operationalStatus, data, keyTxt = 'INFL_ASSCT_BFR_WQLT_TP') =
|
||||
operationalStatus.winterSunnyMax = data.winterSunny && data.winterSunny['MAX_' + keyTxt] ? Number(Math.round(data.winterSunny['MAX_' + keyTxt] * 1.3 * 1000) / 1000).toFixed(3).toString() : '';
|
||||
}
|
||||
|
||||
type RtnFlowType = {
|
||||
inflAmnt: string | number;
|
||||
infoRnDay: string | number;
|
||||
bscFctCd: string;
|
||||
msrDt: string;
|
||||
type wtrUsgYearsType = {
|
||||
YEAR: string;
|
||||
WTR_USG: number;
|
||||
}
|
||||
|
||||
type RtnFlowResponse = {
|
||||
data: RtnFlowType[];
|
||||
type wtrUsgYearsResponse = {
|
||||
data: wtrUsgYearsType[];
|
||||
count: number;
|
||||
}
|
||||
|
||||
const searchWaterUsage = async (searchYear: string, fcltyCd: string) => {
|
||||
const waterUsage = [0, 0, 0];
|
||||
const waterUsage = [0, 0, 0]; // searchYear, searchYear-1, searchYear-2
|
||||
|
||||
for (let i = 0; i < 3; i++) {
|
||||
try {
|
||||
const res = await getFetch('fo', '/fclt/flow/' + fcltyCd + '/' + (Number(searchYear) - i)) as RtnFlowResponse;
|
||||
let totWaterUsage = 0;
|
||||
|
||||
if (res && res.data && Array.isArray(res.data)) {
|
||||
res.data.forEach((item: RtnFlowType) => {
|
||||
totWaterUsage += Number(item.inflAmnt);
|
||||
});
|
||||
|
||||
if (res.count > 0) {
|
||||
const avg = totWaterUsage / res.count;
|
||||
waterUsage[i] = parseFloat((avg * 0.65).toFixed(2));
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`Error fetching water usage for year ${Number(searchYear) - i}:`, error);
|
||||
waterUsage[i] = 0;
|
||||
}
|
||||
const res = await getFetch('fo', '/dashBoard/wtrUsgYears/' + searchYear + '/' + fcltyCd) as wtrUsgYearsResponse;
|
||||
let i = 0;
|
||||
if (res && res.data && Array.isArray(res.data)) {
|
||||
res.data.forEach((item: wtrUsgYearsType) => {
|
||||
waterUsage[i] = item.WTR_USG;
|
||||
i++;
|
||||
});
|
||||
}
|
||||
|
||||
return waterUsage;
|
||||
@@ -1314,7 +1275,7 @@ export const dashBoardReducer = (
|
||||
}));
|
||||
let waterUsage = [0, 0, 0];
|
||||
waterUsage = await searchWaterUsage(targetYear, fcltyCd); // /fclt/flow/{fcltyCd}/{year}
|
||||
|
||||
console.log(waterUsage);
|
||||
set((state: DashBoardType) => ({
|
||||
...state,
|
||||
PlanFclty: {
|
||||
@@ -1834,9 +1795,9 @@ export const dashBoardReducer = (
|
||||
const rtnData = await calcWaterQltyData(operationalStatusList, searchYear, fcltyCd); // 수질 데이터 청천시, 강우시 재계산
|
||||
|
||||
// 총인설비가 없을 경우 제외
|
||||
console.log('총인시설 여부 : ', data.yearData?.TP_FCT_YN);
|
||||
// console.log('총인시설 여부 : ', data.yearData?.TP_FCT_YN);
|
||||
|
||||
console.log('rtnData : ', rtnData);
|
||||
// console.log('rtnData : ', rtnData);
|
||||
if (data.yearData?.TP_FCT_YN !== 'Y') {
|
||||
operationalStatusList = rtnData.slice(0, 11);
|
||||
} else {
|
||||
|
||||
@@ -5,7 +5,7 @@ NEXT_PUBLIC_AUTH_USER_ID = token-id
|
||||
NEXT_PUBLIC_ACCESS_TOKEN = access-token
|
||||
NEXT_PUBLIC_REFRESH_TOKEN = refresh-token
|
||||
NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11302
|
||||
NEXT_PUBLIC_SUB_DOMAIN = http://con.mind-one.co.kr:11300
|
||||
NEXT_PUBLIC_SUB_DOMAIN = http://con.mind-one.co.kr:13000
|
||||
NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000
|
||||
NEXT_PUBLIC_GEOSERVER_URL = https://hasudo.geo.rsonesoft.com/geoserver
|
||||
NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver
|
||||
|
||||
@@ -19,15 +19,14 @@ import { LoginApi } from "@/entities/auth";
|
||||
import { useEffect } from "react";
|
||||
import { getCookie } from "@/shared/lib";
|
||||
import { AUTH_USER_ID } from "@/shared/config";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
export default function Home() {
|
||||
const router = useRouter();
|
||||
const checkToken = getCookie(AUTH_USER_ID);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
const hostname = window.location.hostname;
|
||||
|
||||
|
||||
if (hostname === "localhost" || hostname === "127.0.0.1" || hostname === "con.mind-one.co.kr") {
|
||||
if (!checkToken) {
|
||||
async function doLogin() {
|
||||
@@ -39,7 +38,7 @@ export default function Home() {
|
||||
}
|
||||
}
|
||||
doLogin();
|
||||
} else router.push("/map");
|
||||
} else router.push("/map");
|
||||
} else window.location.href = "/map";
|
||||
} else window.location.href = "/map";
|
||||
}, []);
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ const AuthWrapper = ({ children }: { children: React.ReactNode }) => {
|
||||
|
||||
// 개발 환경에서는 localhost 도메인 사용
|
||||
if (hostname === "localhost" || hostname === "127.0.0.1" || hostname === "con.mind-one.co.kr")
|
||||
router.push("/"); // 개발시 홈으로 돌아가기
|
||||
window.location.href = "/";
|
||||
|
||||
// 운영 환경에서는 서브도메인을 포함한 최상위 도메인 사용
|
||||
// router.push는 같은 Next.js 앱 내에서만 작동하므로 다른 앱으로 이동할 때는 window.location.href 사용
|
||||
|
||||
@@ -3,7 +3,7 @@ import { PROXY_HOST } from "./env";
|
||||
// 브라우저에서는 동일 오리진으로 상대경로 호출 → CORS/localhost 고정 문제 방지
|
||||
// (Next middleware가 /server/* 요청을 백엔드로 rewrite)
|
||||
// 서버 환경(SSR 등)에서는 절대 URL이 필요할 수 있어 기존 PROXY_HOST 기반 유지
|
||||
export const BASE_URL = typeof window === "undefined" ? `${PROXY_HOST}/server` : "/server";
|
||||
export const BASE_URL = `${PROXY_HOST}/server`;
|
||||
|
||||
export const ENDPOINT = {
|
||||
ATTACH_SERVICE: {
|
||||
|
||||
Reference in New Issue
Block a user