From 64b022501905892e8d5b316f9bbc7a961c4d89b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sanguu=28=EB=B0=95=EC=83=81=ED=98=84=29?= Date: Mon, 7 Nov 2022 17:46:45 +0900 Subject: [PATCH] =?UTF-8?q?=EB=82=A0=EC=94=A8=20api=20=EA=B2=80=EC=83=89?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5-=EB=AF=B8=EA=B8=B0=EB=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../flight/plan/FlightPlanAreaDetailForm.js | 361 ++++++++------- .../basis/flight/plan/TodayWeather.js | 420 ++++++++++++++++++ .../basis/flight/actions/basisFlightAction.ts | 18 +- .../basis/flight/apis/basisFlightApi.ts | 11 +- .../basis/flight/models/basisFlightModel.ts | 37 ++ .../flight/reducers/basisFlightReducer.ts | 10 +- .../basis/flight/sagas/basisFlightSaga.ts | 31 +- .../control/gp/actions/controlGpAction.ts | 2 +- .../control/report/ControlReportDetail.js | 76 +--- 9 files changed, 698 insertions(+), 268 deletions(-) create mode 100644 src/components/basis/flight/plan/TodayWeather.js diff --git a/src/components/basis/flight/plan/FlightPlanAreaDetailForm.js b/src/components/basis/flight/plan/FlightPlanAreaDetailForm.js index 147082e..583fc5b 100644 --- a/src/components/basis/flight/plan/FlightPlanAreaDetailForm.js +++ b/src/components/basis/flight/plan/FlightPlanAreaDetailForm.js @@ -1,4 +1,6 @@ import React, { useEffect, useState } from 'react'; +import { TodayWeather, TomorrowWeahter, AfterTomorrowWeahter, LastwWeahter } from '../../../basis/flight/plan/TodayWeather' +import { FlightweatherAction } from '../../../../modules/basis/flight/actions/basisFlightAction' import { Card, CardBody, @@ -12,6 +14,10 @@ import { Input, Table } from 'reactstrap'; +import dfsxyconv from '../../../../utility/dfsxyconv'; +import { useDispatch, useSelector } from 'react-redux'; +import moment from 'moment'; + import { Search, Compass, @@ -23,7 +29,7 @@ import { CloudSnow, Navigation2 } from 'react-feather'; - +import { object } from 'prop-types'; const FlightPlanAreaDetailForm = ({ handleSave, handleClose, @@ -34,7 +40,141 @@ const FlightPlanAreaDetailForm = ({ isDone, isDisabled }) => { + + const [dayData, setdayData] = useState({}); + const coordList = data ? data[0].coordList : null; + const dispatch = useDispatch(); + const { weather } = useSelector(state => state.flightState); + let now = moment(); + let date = moment().format('YYYYMMDD') + let time = moment().format('HHmm') + let plus_day1 = moment().add(1, "day").format('YYYYMMDD'); + let plus_day2 = moment().add(2, "day").format('YYYYMMDD'); + + useEffect(() => { + if (weather) { + let wheatherobj = {}; + const weatherData = weather?.item; + //오늘 날씨 필터링 + const todayres = weatherData.filter(weatherData => weatherData.fcstDate == date); + const todayData = todayres.filter(todayres => { + switch (todayres.category) { + case "TMP": + case "SKY": + case "VEC": + case "WSD": + case "PTY": + return { ...todayres } + } + }); + //내일 날씨 필터링todayres.category == ("TMP" || "SKY" || "VEC" || "WSD" || "PTY") + const tomorrowres = weatherData.filter(weatherData => weatherData.fcstDate == plus_day1); + const tomorrowData = tomorrowres.filter(tomorrowres => { + switch (tomorrowres.category) { + case "TMP": + case "SKY": + case "VEC": + case "WSD": + case "PTY": + return { ...todayres } + } + }); + //모레 날씨 필터링 + const afterres = weatherData.filter(weatherData => weatherData.fcstDate == plus_day2); + const afterData = afterres.filter(afterres => { + switch (afterres.category) { + case "TMP": + case "SKY": + case "VEC": + case "WSD": + case "PTY": + return { ...todayres } + } + }); + wheatherobj = { + todayData, + tomorrowData, + afterData, + } + setdayData({ ...wheatherobj }); + } + }, [weather]) + useEffect(() => { + + if (data[0]?.coordList[0].lat != 0 || data[0]?.coordList[0].lon != 0) { + let nx = data[0]?.coordList[0].lat; + let ny = data[0]?.coordList[0].lon; + const rs = dfsxyconv("toXY", nx, ny); + + let now = new Date(); + let hours = now.getHours(); + let minutes = now.getMinutes(); + let basetime = "2300"; + + if ((hours >= 2 && minutes > 9) && hours <= 5) { + basetime = "0200"; + } + else if ((hours >= 5 && minutes > 9) && hours < 8) { + basetime = "0500"; + } + else if (hours <= 8 && minutes < 10) { + basetime = "0500"; + } + else if ((hours >= 8 && minutes > 9) && hours < 11) { + basetime = "0800"; + } + else if (hours <= 11 && minutes < 10) { + basetime = "0800"; + } + else if (((hours >= 11 && minutes > 9) && hours < 14)) { + basetime = "1100"; + } + else if (hours <= 14 && minutes < 10) { + basetime = "1100"; + } + else if ((hours >= 14 && minutes > 9) && hours < 17) { + basetime = "1400"; + } + else if (hours <= 17 && minutes < 10) { + basetime = "1400"; + } + else if ((hours >= 17 && minutes > 9) && hours < 20) { + basetime = "1700"; + } + else if (hours <= 20 && minutes < 10) { + basetime = "2000"; + } + else if ((hours >= 20 && minutes > 9) && hours < 23) { + basetime = "2000"; + } + else if (hours <= 23 && minutes < 10) { + basetime = "2300"; + } + else if (hours >= 23 && minutes > 9) { + basetime = "2300"; + } + + const apidata = { + serviceKey: "r6RMUsk3Vtama7D6uq7MiWV9dTC9MwfIIr4%2F45y0uVNw6BaYbgpKmL%2BLUDFVTfIYUmEe4K%2FaniEjdV9mg5t82Q%3D%3D", + numOfRows: 1000, + pageNo: 1, + dataType: "JSON", + base_date: date, + base_time: basetime, + nx: rs.x, + ny: rs.y, + } + dispatch(FlightweatherAction.request(apidata)); + } + }, [data]) + + + const [active, setActive] = useState('active'); + const [activeTab, setActiveTab] = useState('1'); + const toggle = tab => { + return setActiveTab(tab); + }; return ( @@ -131,8 +271,8 @@ const FlightPlanAreaDetailForm = ({ : coordList[0].lat && data[0].areaType && data[0].areaType !== 'POLYGON' - ? false - : true + ? false + : true } placeholder='반경' value={ @@ -158,8 +298,8 @@ const FlightPlanAreaDetailForm = ({ : coordList[0].lat && data[0].areaType && data[0].areaType !== 'POLYGON' - ? false - : true + ? false + : true } onClick={() => handleBufferList()} > @@ -261,177 +401,54 @@ const FlightPlanAreaDetailForm = ({ 닫기 -
-
-
-
-
- 검색하신 지역의 날씨 정보입니다. - - 인천광역시 부평구 안남로 272 - -
- {/* 탭메뉴or탭내용 활성화 active */} -
-
    -
  • 오늘
  • -
  • 주간
  • -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
시각날씨기온풍향풍속
10시 - - 27℃ - - 2m/s
12시 - - 30℃ - - 3m/s
14시 - - 28℃ - - 4m/s
16시 - - 27℃ - - 7m/s
18시 - - 25℃ - - 2m/s
20시 - - 26℃ - - 2m/s
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
날짜날씨기온
06.19.(토) 오전 - - 최저 27℃
06.19.(토) 오후 - - 30℃
06.20.(일) 오전 - - 30℃
06.20.(일) 오후 - - 30℃
06.21.(월) 오전 - - 30℃
06.21.(월) 오후 - - 30℃
06.22.(화) 오전 - - 30℃
06.2.(화) 오후 - - 30℃
+ + {Object.keys(dayData).length != 0 && data[0]?.coordList[0].lat != 0 ? ( + +
+
+
+
+
+ 검색하신 지역의 날씨 정보입니다. + + 인천광역시 부평구 안남로 272 + +
+
+
    +
  • toggle('1')} >오늘
  • +
  • toggle('2')} >내일
  • +
  • toggle('3')} >모레
  • +
+
+ {activeTab == 1 ? +
+ +
+ : + <> + } + {activeTab == 2 ? +
+ +
+ : + <> + } + {activeTab == 3 ? +
+ +
+ : + <> + } +
-
+ ) : + null} diff --git a/src/components/basis/flight/plan/TodayWeather.js b/src/components/basis/flight/plan/TodayWeather.js new file mode 100644 index 0000000..a0ddbe5 --- /dev/null +++ b/src/components/basis/flight/plan/TodayWeather.js @@ -0,0 +1,420 @@ +import { + Card, + CardBody, + Col, + FormGroup, + Label, + Row, + Button, + InputGroupAddon, + InputGroup, + Input, + Table +} from 'reactstrap'; +import { + Search, + Compass, + Sun, + CloudLightning, + Cloud, + CloudRain, + CloudDrizzle, + CloudSnow, + Navigation2 +} from 'react-feather'; +import { mapTypeChangeAction } from '../../../../modules/control/map/actions/controlMapActions'; +export function TodayWeather({ todayData }) { + todayData?.fcstTime?.sort([compareFunction]); + const dayres = todayData?.filter(dayData => { + switch (dayData?.fcstTime) { + case "0200": + case "0500": + case "0500": + case "0800": + case "1100": + case "1400": + case "1700": + case "2000": + case "2300": + return { ...dayData?.todayData } + } + }); + + + // 배열.reduce((누적값, 현잿값, 인덱스, 요소) => { return 결과 }, 초깃값); + const groupValues = dayres.reduce((acc, current) => { + acc[current.fcstTime] = acc[current.fcstTime] || []; + acc[current.fcstTime].push({ category: current.category, fcstValue: current.fcstValue }); + return acc; + }, {}); + // 위에서 만든 객체를 key로 돌려서 새로운 객체 return + const groups = Object.keys(groupValues).map((key) => { + return { fcstTime: key, category: groupValues[key] }; + }); + + return ( + <> + {dayres.length > 0 ? ( + + + + + + + + + + + + + {groups.map((i) => { + return ( + + + {i.category[4].fcstValue == "0" ? + + : + } + + + + + ) + })} + +
시각날씨기온풍향풍속
{i.fcstTime.substring(0, 2)}시 + {i.category[3].fcstValue == "1" ? : } + + {i.category[4].fcstValue == "3" ? : } + {i.category[0].fcstValue}℃ + + {i.category[2].fcstValue}
+ ) : + null} + + ) +} + + +export function TomorrowWeahter({ tomorrowData }) { + tomorrowData?.fcstTime?.sort([compareFunction]); + const dayres = tomorrowData?.filter(dayData => { + switch (dayData?.fcstTime) { + case "0200": + case "0500": + case "0500": + case "0800": + case "1100": + case "1400": + case "1700": + case "2000": + case "2300": + return { ...dayData?.tomorrowData } + } + }); + return ( + + + + + + + + + + + + + + {dayres[3].fcstValue != "0" ? + + : + } + + + + + + + {dayres[8].fcstValue != "0" ? + + : + } + + + + + + + {dayres[13].fcstValue != "0" ? + + : + } + + + + + + + {dayres[18].fcstValue != "0" ? + + : + } + + + + + + + {dayres[23].fcstValue != "0" ? + + : + } + + + + + + + {dayres[28].fcstValue != "0" ? + + : + } + + + + + + + {dayres[33].fcstValue != "0" ? + + : + } + + + + + + + {dayres[38].fcstValue != "0" ? + + : + } + + + + + +
시각날씨기온풍향풍속
{dayres[0]?.fcstTime.substring(0, 2)}시 + {dayres[3].fcstValue == "1" ? : } + + {dayres[4].fcstValue == "3" ? : } + {dayres[0].fcstValue}℃ + + {dayres[2].fcstValue}
{dayres[5].fcstTime.substring(0, 2)}시 + {dayres[8].fcstValue == "1" ? : } + + {dayres[9].fcstValue == "3" ? : } + {dayres[5].fcstValue}℃ + + {dayres[7].fcstValue}
{dayres[10].fcstTime.substring(0, 2)}시 + {dayres[13].fcstValue == "1" ? : } + + {dayres[14].fcstValue == "3" ? : } + {dayres[10].fcstValue}℃ + + {dayres[12].fcstValue}
{dayres[15].fcstTime.substring(0, 2)}시 + {dayres[18].fcstValue == "1" ? : } + + {dayres[19].fcstValue == "3" ? : } + {dayres[15].fcstValue}℃ + + {dayres[17].fcstValue}
{dayres[20].fcstTime.substring(0, 2)}시 + {dayres[23].fcstValue == "1" ? : } + + {dayres[24].fcstValue == "3" ? : } + {dayres[20].fcstValue}℃ + + {dayres[22].fcstValue}
{dayres[25].fcstTime.substring(0, 2)}시 + {dayres[28].fcstValue == "1" ? : } + + {dayres[29].fcstValue == "3" ? : } + {dayres[25].fcstValue}℃ + + {dayres[27].fcstValue}
{dayres[30].fcstTime.substring(0, 2)}시 + {dayres[33].fcstValue == "1" ? : } + + {dayres[34].fcstValue == "3" ? : } + {dayres[30].fcstValue}℃ + + {dayres[32].fcstValue}
{dayres[35].fcstTime.substring(0, 2)}시 + {dayres[38].fcstValue == "1" ? : } + + {dayres[39].fcstValue == "3" ? : } + {dayres[35].fcstValue}℃ + + {dayres[37].fcstValue}
+ ) +} +export function AfterTomorrowWeahter({ afterData }) { + afterData?.fcstTime?.sort([compareFunction]); + const dayres = afterData?.filter(dayData => { + switch (dayData?.fcstTime) { + case "0200": + case "0500": + case "0500": + case "0800": + case "1100": + case "1400": + case "1700": + case "2000": + case "2300": + return { ...dayData?.afterData } + } + }); + console.log(dayres); + + return ( + + + + + + + + + + + + + + {dayres[3].fcstValue != "0" ? + + : + } + + + + + + + {dayres[8].fcstValue != "0" ? + + : + } + + + + + + + {dayres[13].fcstValue != "0" ? + + : + } + + + + + + + {dayres[18].fcstValue != "0" ? + + : + } + + + + + + + {dayres[23].fcstValue != "0" ? + + : + } + + + + + + + {dayres[28].fcstValue != "0" ? + + : + } + + + + + + + {dayres[33].fcstValue != "0" ? + + : + } + + + + + + + {dayres[38].fcstValue != "0" ? + + : + } + + + + + +
시각날씨기온풍향풍속
{dayres[0].fcstTime.substring(0, 2)}시 + {dayres[3].fcstValue == "1" ? : } + + {dayres[4].fcstValue == "3" ? : } + {dayres[0].fcstValue}℃ + + {dayres[2].fcstValue}
{dayres[5].fcstTime.substring(0, 2)}시 + {dayres[8].fcstValue == "1" ? : } + + {dayres[9].fcstValue == "3" ? : } + {dayres[5].fcstValue}℃ + + {dayres[7].fcstValue}
{dayres[10].fcstTime.substring(0, 2)}시 + {dayres[13].fcstValue == "1" ? : } + + {dayres[14].fcstValue == "3" ? : } + {dayres[10].fcstValue}℃ + + {dayres[12].fcstValue}
{dayres[15].fcstTime.substring(0, 2)}시 + {dayres[18].fcstValue == "1" ? : } + + {dayres[19].fcstValue == "3" ? : } + {dayres[15].fcstValue}℃ + + {dayres[17].fcstValue}
{dayres[20].fcstTime.substring(0, 2)}시 + {dayres[23].fcstValue == "1" ? : } + + {dayres[24].fcstValue == "3" ? : } + {dayres[20].fcstValue}℃ + + {dayres[22].fcstValue}
{dayres[25].fcstTime.substring(0, 2)}시 + {dayres[28].fcstValue == "1" ? : } + + {dayres[29].fcstValue == "3" ? : } + {dayres[25].fcstValue}℃ + + {dayres[27].fcstValue}
{dayres[30].fcstTime.substring(0, 2)}시 + {dayres[33].fcstValue == "1" ? : } + + {dayres[34].fcstValue == "3" ? : } + {dayres[30].fcstValue}℃ + + {dayres[32].fcstValue}
{dayres[35].fcstTime.substring(0, 2)}시 + {dayres[38].fcstValue == "1" ? : } + + {dayres[39].fcstValue == "3" ? : } + {dayres[35].fcstValue}℃ + + {dayres[37].fcstValue}
+ ) +} diff --git a/src/modules/basis/flight/actions/basisFlightAction.ts b/src/modules/basis/flight/actions/basisFlightAction.ts index 30d5d4c..a25620d 100644 --- a/src/modules/basis/flight/actions/basisFlightAction.ts +++ b/src/modules/basis/flight/actions/basisFlightAction.ts @@ -11,7 +11,9 @@ import { PilotSelectData, SelectGroupData, BasFlightAprovData, - BasFlightScheduleList + BasFlightScheduleList, + weatherData, + resweatherData } from '../models/basisFlightModel'; // 공역 조회 @@ -86,6 +88,10 @@ const AREA_DETAIL_INITIAL = 'basis/flight/plan/detail/AREA_DETAIL_INIT'; const AREA_BUFFER_LIST_REQUEST = 'basis/flight/plan/area/BUFFER_LIST_REQUEST'; const AREA_BUFFER_LIST_SUCCESS = 'basis/flight/plan/area/BUFFER_LIST_SUCCESS'; const AREA_BUFFER_LIST_FAILURE = 'basis/flight/plan/area/BUFFER_LIST_FAILURE'; +// 날씨 +const FLIGHT_WEATHER_REQUEST = 'control/gp/FLIGHT_WEATHER_REQUEST'; +const FLIGHT_WEATHER_SUCCESS = 'control/gp/FLIGHT_WEATHER_SUCCESS'; +const FLIGHT_WEATHER_FAILURE = 'control/gp/FLIGHT_WEATHER_FAILURE'; // 비행계획서 조회(승인) const FLIGHT_APRV_LIST_REQUEST = @@ -255,6 +261,13 @@ export const FLIGHT_SCHEDULE_LIST = createAsyncAction( FLIGHT_SCHEDULE_FAILURE )(); +//비행구역 설정 날씨 API +export const FlightweatherAction = createAsyncAction( + FLIGHT_WEATHER_REQUEST, + FLIGHT_WEATHER_SUCCESS, + FLIGHT_WEATHER_FAILURE +)(); + const actions = { PUBLIC_AREA_LIST, // FLIGHT_PLAN_AREA, @@ -277,7 +290,8 @@ const actions = { FLIGHT_APRV_LIST, FLIGHT_APRV_PROC, SEARCH_AREA, - FLIGHT_SCHEDULE_LIST + FLIGHT_SCHEDULE_LIST, + FlightweatherAction }; export type FlightAction = ActionType; diff --git a/src/modules/basis/flight/apis/basisFlightApi.ts b/src/modules/basis/flight/apis/basisFlightApi.ts index edb43ce..a9a1bfb 100644 --- a/src/modules/basis/flight/apis/basisFlightApi.ts +++ b/src/modules/basis/flight/apis/basisFlightApi.ts @@ -5,7 +5,8 @@ import { FlightPlanAreaData, FlightPlanAreaDataList, FlightPlanData, - FlightPlanListRqData + FlightPlanListRqData, + weatherData } from '../models/basisFlightModel'; export const flightPlanAPI = { @@ -53,6 +54,14 @@ export const flightPlanAPI = { const res = await axios.post(`api/bas/flight/plan/area/buffer`, data); return res; }, + apiweather: async (rq: weatherData) => { + const { data } = await axios.get(`api/bas/flight/plan/api/weather`, { + params: { + ...rq + } + }); + return data; + }, aprvList: async (data: FlightPlanListRqData) => { const queryString = qs.stringify(data, { addQueryPrefix: true, diff --git a/src/modules/basis/flight/models/basisFlightModel.ts b/src/modules/basis/flight/models/basisFlightModel.ts index ec4eba3..6542442 100644 --- a/src/modules/basis/flight/models/basisFlightModel.ts +++ b/src/modules/basis/flight/models/basisFlightModel.ts @@ -18,6 +18,42 @@ export interface FlightState { page: number | 1; total: number | 0; conut: number | 0; + weather: resweatherData | undefined; +} +export interface weatherData { + serviceKey: string; + numOfRows: string; + pageNo: string; + dataType: string; + base_date: string; + base_time: string; + nx: string; + ny: string; +} +export interface resweatherData { + resultCode: string; + resultMsg: string; + numOfRows: string; + pageNo: string; + totalCount: string; + dataType: string; + baseDate: string; + baseTime: string; + fcstDate: string; + fcstTime: string; + category: string; + fcstValue: string; + nx: string; + ny: string; + hstryAreaSno: string; + area1: string; + area2: string; + area3: string; + zipCd: string; + landNm: string; + landNum: string; + areaType: string; + areaNm: string; } export interface SelectGroupData { @@ -197,6 +233,7 @@ export interface BasFlightScheduleData { } export const initFlight = { + weather: undefined, page: 1, total: 0, conut: 0, diff --git a/src/modules/basis/flight/reducers/basisFlightReducer.ts b/src/modules/basis/flight/reducers/basisFlightReducer.ts index 2b283df..43493eb 100644 --- a/src/modules/basis/flight/reducers/basisFlightReducer.ts +++ b/src/modules/basis/flight/reducers/basisFlightReducer.ts @@ -5,7 +5,8 @@ import * as Actions from '../actions/basisFlightAction'; import { FlightState, initFlight, - initFlightBas + initFlightBas, + resweatherData } from '../models/basisFlightModel'; import { any } from 'prop-types'; @@ -111,6 +112,13 @@ export const flightReducer = createReducer( draft.areaCoordList = data; }) ) + //비행구역설정 날씨 API + .handleAction(Actions.FlightweatherAction.success, (state, action) => + produce(state, draft => { + const data: resweatherData = action.payload; + draft.weather = data; + }) + ) // 조종사, 기체 선택 초기화 .handleAction(Actions.AREA_DETAIL_INIT, (state, action) => produce(state, draft => { diff --git a/src/modules/basis/flight/sagas/basisFlightSaga.ts b/src/modules/basis/flight/sagas/basisFlightSaga.ts index b5ba4b4..218bd2f 100644 --- a/src/modules/basis/flight/sagas/basisFlightSaga.ts +++ b/src/modules/basis/flight/sagas/basisFlightSaga.ts @@ -47,23 +47,6 @@ function* listAreaSaga( } } -// function* createFlightPlanArea(action: ActionType) { -// try { -// const data = action.payload; -// -// yield put( -// Actions.FLIGHT_PLAN_AREA.success({ -// data: data -// }) -// ) -// -// } catch (error: any) { -// yield put( -// Actions.FLIGHT_PLAN_AREA.failure(error) -// ) -// } -// } - // 비행계획서 목록 function* listPlanSaga( action: ActionType @@ -113,7 +96,18 @@ function* detailPlanSaga( yield put(Actions.FLIGHT_PLAN_DETAIL.failure(error)); } } - +//비행 구역 설정 날씨 API +function* WeatherSaga( + action: ActionType +) { + try { + const rq = action.payload; + const data = yield call(Apis.flightPlanAPI.apiweather, rq); + yield put(Actions.FlightweatherAction.success(data.response.body.items)); + } catch (error) { + yield put(Actions.FlightweatherAction.failure(error)); + } +} // 비행계획서 등록 function* createPlanSaga( action: ActionType @@ -454,4 +448,5 @@ export function* flightSaga() { yield takeEvery(Actions.FLIGHT_APRV_PROC.request, aprvProcSaga); yield takeEvery(Actions.SEARCH_AREA.request, searchAreaSaga); yield takeEvery(Actions.FLIGHT_SCHEDULE_LIST.request, scheduleListSaga); + yield takeEvery(Actions.FlightweatherAction.request, WeatherSaga); } diff --git a/src/modules/control/gp/actions/controlGpAction.ts b/src/modules/control/gp/actions/controlGpAction.ts index 82de718..d7acfb1 100644 --- a/src/modules/control/gp/actions/controlGpAction.ts +++ b/src/modules/control/gp/actions/controlGpAction.ts @@ -54,7 +54,7 @@ const CONTROL_GP_LOG_REQIEST = 'control/gp/CONTROL_GP_LOG_REQUEST'; const CONTROL_GP_LOG_SUCCESS = 'control/gp/CONTROL_GP_LOG_SUCCESS'; const CONTROL_GP_LOG_FAILURE = 'control/gp/CONTROL_GP_LOG_FAILURE'; -//로그 리스트 조회 +//날씨 API const CONTROL_WEATHER_REQUEST = 'control/gp/CONTROL_WEATHER_REQUEST'; const CONTROL_WEATHER_SUCCESS = 'control/gp/CONTROL_WEATHER_SUCCESS'; const CONTROL_WEATHER_FAILURE = 'control/gp/CONTROL_WEATHER_FAILURE'; diff --git a/src/views/control/report/ControlReportDetail.js b/src/views/control/report/ControlReportDetail.js index 81f0563..d4f6c57 100644 --- a/src/views/control/report/ControlReportDetail.js +++ b/src/views/control/report/ControlReportDetail.js @@ -11,7 +11,6 @@ import { GET_ARCTFT_TYPE_CD, GET_WGHT_TYPE_CD } from '../../../utility/CondeUtil'; -import dfsxyconv from '../../../utility/dfsxyconv'; import { controlGpLogAction, controlweatherAction } from '../../../modules/control/gp'; import ControlAlarmDetail from '../alarm/ControlAlarmDetail'; import axios from '../../../modules/utils/customAxiosUtil'; @@ -37,7 +36,7 @@ const ControlReportDetail = props => { const { controlGpWarnLog } = useSelector(state => state.controlGpLogState); - function a() { + function weathericon() { if (controlDetail) { let wheatherDetail = controlDetail.items.item; let skyDetail = wheatherDetail[6].fcstValue; @@ -51,76 +50,7 @@ const ControlReportDetail = props => { return ; } } - // console.log("time", time); - // useEffect(() => { - // if (controlGpDetail) { - // const rs = dfsxyconv("toXY", controlGpDetail?.lat, controlGpDetail?.lng); - // let now = new Date(); - // let year = now.getFullYear(); // 년도 - // let month = now.getMonth() + 1; // 월 - // let day = ('0' + now.getDate()).slice(-2); // 날짜 - // const today = `${year}${month}${day}`; - // let hours = now.getHours(); - // let minutes = now.getMinutes(); - // let basetime = "2300"; - - // if ((hours >= 2 && minutes > 9) && hours <= 5) { - // basetime = "0200"; - // } - // else if ((hours >= 5 && minutes > 9) && hours < 8) { - // basetime = "0500"; - // } - // else if (hours >= 8 && minutes < 10) { - // basetime = "0500"; - // } - // else if ((hours >= 8 && minutes > 9) && hours < 11) { - // basetime = "0800"; - // } - // else if (hours >= 11 && minutes < 10) { - // basetime = "0800"; - // } - // else if (hours >= 11 && hours < 14) { - // basetime = "1100"; - // } - // else if (hours >= 14 && minutes < 10) { - // basetime = "1100"; - // } - // else if ((hours >= 14 && minutes > 9) && hours < 17) { - // basetime = "1400"; - // } - // else if (hours >= 17 && minutes < 10) { - // basetime = "1400"; - // } - // else if ((hours >= 17 && minutes > 9) && hours < 20) { - // basetime = "1700"; - // } - // else if (hours >= 20 && minutes < 10) { - // basetime = "2000"; - // } - // else if ((hours >= 20 && minutes > 9) && hours < 23) { - // basetime = "2000"; - // } - // else if (hours >= 23 && minutes < 10) { - // basetime = "2300"; - // } - // else if (hours >= 23 && minutes > 9) { - // basetime = "2300"; - // } - // const apidata = { - // serviceKey: "r6RMUsk3Vtama7D6uq7MiWV9dTC9MwfIIr4%2F45y0uVNw6BaYbgpKmL%2BLUDFVTfIYUmEe4K%2FaniEjdV9mg5t82Q%3D%3D", - // numOfRows: 14, - // pageNo: 1, - // dataType: "JSON", - // base_date: today, - // base_time: basetime, - // nx: rs.x, - // ny: rs.y, - // } - // dispatch(controlweatherAction.request(apidata)); - // } - - // }, [controlGpDetail]) useEffect(() => { if (historyModal) { @@ -352,8 +282,8 @@ const ControlReportDetail = props => { - {controlDetail?.items.item[12].fcstTime.substring(0, 2)}시 - {a()} + {controlDetail?.items.item[0].baseTime.substring(0, 2)}시 + {weathericon()} {controlDetail?.items.item[12].fcstValue}℃ {controlDetail?.items.item[4].fcstValue}m/s