From 37797361e4ec735834ff69287d867e929e8e7a51 Mon Sep 17 00:00:00 2001 From: tomatozil Date: Thu, 20 Feb 2025 12:11:00 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20=EC=8B=9C=EC=97=B0=20=EC=98=81?= =?UTF-8?q?=EC=83=81=EC=9D=84=20=EC=9C=84=ED=95=9C=20=EC=84=B8=ED=8C=85=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 --- .../src/main/resources/data/init-data.sql | 8 ++--- .../simulation/start-three-containers.sh | 12 ++++++- .../org/emulator/EmulatorApplication.java | 5 ++- .../src/main/resources/application.yml | 33 +++++++++++++++---- .../src/main/resources/templates/home.html | 12 +++---- .../src/main/resources/application-dev.yml | 2 +- 6 files changed, 53 insertions(+), 19 deletions(-) diff --git a/monicar-control-center/src/main/resources/data/init-data.sql b/monicar-control-center/src/main/resources/data/init-data.sql index 882d3ca8..ea67ca2a 100644 --- a/monicar-control-center/src/main/resources/data/init-data.sql +++ b/monicar-control-center/src/main/resources/data/init-data.sql @@ -20,13 +20,13 @@ INSERT INTO vehicle_information (vehicle_id, company_id, vehicle_type_id, vehicle_number, mdn, tid, mid, pv, did, driving_days, sum, lat, lng, status, delivery_date, created_at, updated_at, deleted_at) values (1, 1, 2, '123나1234', 1234567890, 'TID002', 4, 6, 6, 360, 6126, 37565557, 127018624, 'IN_OPERATION', '2025-02-06', '2025-02-06 02:31:59', '2025-02-06 02:31:59', NULL), - (2, 1, 1, '657가5202', 2254690422, 'TID003', 3, 1, 5, 927, 37024, 37567987, 127014246, 'IN_OPERATION', + (2, 1, 1, '657가5202', 2254690422, 'TID003', 3, 1, 5, 927, 0, 37567987, 127014246, 'IN_OPERATION', '2025-02-06', '2025-02-06 20:25:59', '2025-02-06 20:25:59', NULL), - (3, 1, 2, '309가9777', 5246479703, 'TID004', 5, 8, 5, 20, 73907, 37559948, 126968317, 'NOT_REGISTERED', + (3, 1, 2, '309가9777', 5246479703, 'TID004', 5, 8, 5, 20, 0, 37559948, 126968317, 'NOT_REGISTERED', '2025-02-06', '2025-02-06 03:20:59', '2025-02-06 03:20:59', NULL), - (4, 1, 2, '530가4820', 6459804235, 'TID005', 8, 10, 7, 142, 86586, 37561026, 126977640, 'NOT_DRIVEN', + (4, 1, 2, '530가4820', 6459804235, 'TID005', 8, 10, 7, 142, 0, 37561026, 126977640, 'NOT_DRIVEN', '2025-02-06', '2025-02-06 04:19:59', '2025-02-06 04:19:59', NULL), - (5, 1, 2, '762나5310', 4443625351, 'TID006', 5, 3, 8, 12, 6965, 37454837, 127047956, 'IN_OPERATION', + (5, 1, 2, '762나5310', 4443625351, 'TID006', 5, 3, 8, 12, 0, 37454837, 127047956, 'IN_OPERATION', '2025-02-06', '2025-02-06 23:00:59', '2025-02-18 10:26:20', NULL), (6, 1, 1, '302가5423', 4214563846, 'TID007', 4, 5, 5, 13, 58468, 37572557, 127014216, 'NOT_DRIVEN', '2025-02-06', '2025-02-06 10:08:59', '2025-02-06 10:08:59', NULL), diff --git a/monicar-emulator/simulation/start-three-containers.sh b/monicar-emulator/simulation/start-three-containers.sh index 9cdbf3b7..fd035e33 100755 --- a/monicar-emulator/simulation/start-three-containers.sh +++ b/monicar-emulator/simulation/start-three-containers.sh @@ -3,7 +3,17 @@ set -e echo "🛠️ Gradle 프로젝트 빌드 중..." -../../gradlew :monicar-emulator:build --project-dir ../.. +../../gradlew :monicar-emulator:build --project-dir ../.. -x test + +echo "🗑️ 기존 컨테이너 중지 및 삭제..." +CONTAINERS=$(docker ps -aq --filter "name=tomato|banana|apple") + +if [ -n "$CONTAINERS" ]; then + docker rm -f $CONTAINERS + echo "✅ 기존 컨테이너 삭제 완료!" +else + echo "ℹ️ 삭제할 컨테이너 없음." +fi echo "🐳 Docker Compose 빌드 및 컨테이너 실행..." docker compose up --build \ No newline at end of file diff --git a/monicar-emulator/src/main/java/org/emulator/EmulatorApplication.java b/monicar-emulator/src/main/java/org/emulator/EmulatorApplication.java index 0d2c82ae..c4f50a9e 100644 --- a/monicar-emulator/src/main/java/org/emulator/EmulatorApplication.java +++ b/monicar-emulator/src/main/java/org/emulator/EmulatorApplication.java @@ -7,8 +7,10 @@ import jakarta.annotation.PostConstruct; import lombok.extern.slf4j.Slf4j; +import java.util.TimeZone; + @Slf4j -@SpringBootApplication(scanBasePackages = {"org.emulator", "org.common"}) +@SpringBootApplication(scanBasePackages = {"org.emulator"}) public class EmulatorApplication { private final GpsSensor gpsSensor; @@ -22,6 +24,7 @@ public void initSensor() { } public static void main(String[] args) { + TimeZone.setDefault(TimeZone.getTimeZone("UTC")); log.info("[Thread: {}] {}", Thread.currentThread().getName(), "EmulatorApplication run()"); SpringApplication.run(EmulatorApplication.class, args); } diff --git a/monicar-emulator/src/main/resources/application.yml b/monicar-emulator/src/main/resources/application.yml index c4915370..c5487f28 100644 --- a/monicar-emulator/src/main/resources/application.yml +++ b/monicar-emulator/src/main/resources/application.yml @@ -10,7 +10,7 @@ spring: logging: config: classpath:logback-spring-dev.xml file: - path: ${user.dir}/logs + path: ./logs api: transmission-time: 60 @@ -18,7 +18,7 @@ api: # 에뮬레이터를 컨테이너로 만든 상태에서 로컬 event-hub 서버에 요청 보낼 때 # base-url: http://host.docker.internal:8082/api/v1/event-hub/ -file-name: suwon-daejon-gumi-optimized.gpx +file-name: seoul-to-gyeongju_formatted.gpx fixed: vehicle-mdn: 1234567890 @@ -37,8 +37,9 @@ spring: file-name: yangyang-to-daegu_formatted.gpx +# rds vehicle_information 데이터 기준 fixed: - vehicle-mdn: 1234567891 + vehicle-mdn: 2254690422 vehicle-number: 657가5202 --- @@ -54,8 +55,9 @@ spring: file-name: yeosu-to-cheonan_formatted.gpx +# rds vehicle_information 데이터 기준 fixed: - vehicle-mdn: 1234567892 + vehicle-mdn: 5246479703 vehicle-number: 309가9777 --- @@ -71,6 +73,25 @@ spring: file-name: gwangju-to-muju_formatted.gpx +# rds vehicle_information 데이터 기준 +fixed: + vehicle-mdn: 6459804235 + vehicle-number: 530가4820 + +--- +server: + port: 8093 + +spring: + config: + activate: + on-profile: peach + application: + name: monicar-emulator-peach + +file-name: suwon-daejon-gumi-optimized.gpx + +# rds vehicle_information 데이터 기준 fixed: - vehicle-mdn: 1234567893 - vehicle-number: 530가4820 \ No newline at end of file + vehicle-mdn: 4443625351 + vehicle-number: 762나5310 \ No newline at end of file diff --git a/monicar-emulator/src/main/resources/templates/home.html b/monicar-emulator/src/main/resources/templates/home.html index 03c62b4b..431e8dd7 100644 --- a/monicar-emulator/src/main/resources/templates/home.html +++ b/monicar-emulator/src/main/resources/templates/home.html @@ -58,8 +58,8 @@

차량 운행 종료

eventSource.onerror = function (error) { console.error("🚨 SSE 오류 발생:", error); - showTemporaryMessage("gps-info", "❌ GPS 데이터 수신 불가", 3000); - showTemporaryMessage("gps-status", "❌ 상태 스트림 오류", 3000); + showTemporaryMessage("gps-info", "", 3000); + showTemporaryMessage("gps-status", "", 3000); }; @@ -78,12 +78,12 @@

차량 운행 종료

if (data.isSuccess) { document.getElementById("title").textContent = "현재 차량 상태 : 운행중 🚗💨"; } else { - showTemporaryMessage("title", "❌ 차량 운행 시작 불가", 3000); + showTemporaryMessage("title", "❌ 차량 운행 시작 불가", 2000); } }) .catch(error => { console.error('차량 운행 시작 실패:', error); - showTemporaryMessage("title", "❌ 알 수 없는 에러 발생", 3000); + showTemporaryMessage("title", "❌ 알 수 없는 에러 발생", 2000); }); }); @@ -100,12 +100,12 @@

차량 운행 종료

if (data.isSuccess) { document.getElementById("title").textContent = "현재 차량 상태 : 정지 🚘"; } else { - showTemporaryMessage("title", "❌ 차량 운행 종료 불가", 3000); + showTemporaryMessage("title", "❌ 차량 운행 종료 불가", 2000); } }) .catch(error => { console.error('차량 운행 종료 실패:', error); - showTemporaryMessage("title", "❌ 알 수 없는 에러 발생", 3000); + showTemporaryMessage("title", "❌ 알 수 없는 에러 발생", 2000); }); }); diff --git a/monicar-event-hub/src/main/resources/application-dev.yml b/monicar-event-hub/src/main/resources/application-dev.yml index c663e7fc..a9889628 100644 --- a/monicar-event-hub/src/main/resources/application-dev.yml +++ b/monicar-event-hub/src/main/resources/application-dev.yml @@ -44,4 +44,4 @@ api: key: ${API_KEY} base-url: http://localhost:8081/api/v1/alarm/ -alarm-interval-distance: 5000 \ No newline at end of file +alarm-interval-distance: 100 \ No newline at end of file