Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions monicar-control-center/src/main/resources/data/init-data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
12 changes: 11 additions & 1 deletion monicar-emulator/simulation/start-three-containers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
}
Expand Down
33 changes: 27 additions & 6 deletions monicar-emulator/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ spring:
logging:
config: classpath:logback-spring-dev.xml
file:
path: ${user.dir}/logs
path: ./logs

api:
transmission-time: 60
base-url: http://localhost:8082/api/v1/event-hub/
# 에뮬레이터를 컨테이너로 만든 상태에서 로컬 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
Expand All @@ -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

---
Expand All @@ -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

---
Expand All @@ -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
vehicle-mdn: 4443625351
vehicle-number: 762나5310
12 changes: 6 additions & 6 deletions monicar-emulator/src/main/resources/templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ <h4>차량 운행 종료</h4>

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);
};
</script>

Expand All @@ -78,12 +78,12 @@ <h4>차량 운행 종료</h4>
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);
});
});

Expand All @@ -100,12 +100,12 @@ <h4>차량 운행 종료</h4>
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);
});
});

Expand Down
2 changes: 1 addition & 1 deletion monicar-event-hub/src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ api:
key: ${API_KEY}
base-url: http://localhost:8081/api/v1/alarm/

alarm-interval-distance: 5000
alarm-interval-distance: 100