diff --git a/analytics-service/src/main/java/com/kt/event/analytics/config/SampleDataLoader.java b/analytics-service/src/main/java/com/kt/event/analytics/config/SampleDataLoader.java index c299e4a..634be54 100644 --- a/analytics-service/src/main/java/com/kt/event/analytics/config/SampleDataLoader.java +++ b/analytics-service/src/main/java/com/kt/event/analytics/config/SampleDataLoader.java @@ -24,11 +24,10 @@ import java.util.Random; * 샘플 데이터 로더 * * 애플리케이션 시작 시 대시보드 테스트를 위한 샘플 데이터를 자동으로 적재합니다. - * dev, local 프로파일에서만 실행됩니다. + * 모든 프로파일에서 실행되며, 기존 데이터가 있으면 건너뜁니다. */ @Slf4j @Component -@Profile({"dev", "local"}) @RequiredArgsConstructor public class SampleDataLoader implements ApplicationRunner { @@ -88,33 +87,48 @@ public class SampleDataLoader implements ApplicationRunner { List eventStatsList = new ArrayList<>(); // 이벤트 1: 신년맞이 할인 이벤트 (진행중, 높은 성과) + BigDecimal event1Investment = new BigDecimal("5000000"); + BigDecimal event1Revenue = new BigDecimal("14025000"); eventStatsList.add(EventStats.builder() .eventId("evt_2025012301") .eventTitle("신년맞이 20% 할인 이벤트") .storeId("store_001") .totalParticipants(15420) .estimatedRoi(new BigDecimal("280.5")) - .totalInvestment(new BigDecimal("5000000")) + .salesGrowthRate(new BigDecimal("35.8")) + .totalInvestment(event1Investment) + .expectedRevenue(event1Revenue) + .status("ACTIVE") .build()); // 이벤트 2: 설날 특가 이벤트 (진행중, 중간 성과) + BigDecimal event2Investment = new BigDecimal("3500000"); + BigDecimal event2Revenue = new BigDecimal("6485500"); eventStatsList.add(EventStats.builder() .eventId("evt_2025020101") .eventTitle("설날 특가 선물세트 이벤트") .storeId("store_001") .totalParticipants(8950) .estimatedRoi(new BigDecimal("185.3")) - .totalInvestment(new BigDecimal("3500000")) + .salesGrowthRate(new BigDecimal("22.4")) + .totalInvestment(event2Investment) + .expectedRevenue(event2Revenue) + .status("ACTIVE") .build()); // 이벤트 3: 겨울 신메뉴 런칭 이벤트 (종료, 저조한 성과) + BigDecimal event3Investment = new BigDecimal("2000000"); + BigDecimal event3Revenue = new BigDecimal("1910000"); eventStatsList.add(EventStats.builder() .eventId("evt_2025011501") .eventTitle("겨울 신메뉴 런칭 이벤트") .storeId("store_001") .totalParticipants(3240) .estimatedRoi(new BigDecimal("95.5")) - .totalInvestment(new BigDecimal("2000000")) + .salesGrowthRate(new BigDecimal("8.2")) + .totalInvestment(event3Investment) + .expectedRevenue(event3Revenue) + .status("COMPLETED") .build()); return eventStatsList; @@ -204,17 +218,28 @@ public class SampleDataLoader implements ApplicationRunner { // SNS는 좋아요, 댓글, 공유 많음 builder.likes((int) (participants * (2.0 + random.nextDouble()))) .comments((int) (participants * (0.5 + random.nextDouble() * 0.3))) - .shares((int) (participants * (0.8 + random.nextDouble() * 0.4))); + .shares((int) (participants * (0.8 + random.nextDouble() * 0.4))) + .totalCalls(0) + .completedCalls(0) + .averageDuration(0); } else if ("링고비즈".equals(channelName)) { // 링고비즈는 통화 중심 + int totalCalls = (int) (participants * (2.5 + random.nextDouble() * 0.5)); + int completedCalls = (int) (totalCalls * (0.7 + random.nextDouble() * 0.2)); builder.likes(0) .comments(0) - .shares(0); + .shares(0) + .totalCalls(totalCalls) + .completedCalls(completedCalls) + .averageDuration((int) (120 + random.nextDouble() * 180)); // 120~300초 } else { // TV 채널은 SNS 반응 적음 builder.likes((int) (participants * (0.3 + random.nextDouble() * 0.2))) .comments((int) (participants * (0.05 + random.nextDouble() * 0.05))) - .shares((int) (participants * (0.08 + random.nextDouble() * 0.07))); + .shares((int) (participants * (0.08 + random.nextDouble() * 0.07))) + .totalCalls(0) + .completedCalls(0) + .averageDuration(0); } return builder.build();