Compare commits
12 Commits
71a875bc8a
...
e4e3265646
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e4e3265646 | ||
|
|
fe15d55f45 | ||
|
|
451a69534d | ||
|
|
af48eb2528 | ||
|
|
09517a1ff0 | ||
|
|
a155f6470f | ||
|
|
e53b67c66c | ||
|
|
0289976085 | ||
|
|
c866b7606a | ||
|
|
b4e3ccc51c | ||
|
|
5056f388cf | ||
|
|
914b8201e8 |
@ -1,5 +1,7 @@
|
|||||||
package com.ktds.hi;
|
package com.ktds.hi;
|
||||||
|
|
||||||
|
import java.util.TimeZone;
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.autoconfigure.domain.EntityScan;
|
import org.springframework.boot.autoconfigure.domain.EntityScan;
|
||||||
@ -17,6 +19,9 @@ import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
|||||||
public class AnalyticsApplication {
|
public class AnalyticsApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
|
||||||
|
TimeZone.setDefault(TimeZone.getTimeZone("Asia/Seoul"));
|
||||||
SpringApplication.run(AnalyticsApplication.class, args);
|
SpringApplication.run(AnalyticsApplication.class, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,7 +25,7 @@ public interface AiFeedbackJpaRepository extends JpaRepository<AiFeedbackEntity,
|
|||||||
/**
|
/**
|
||||||
* 매장 ID로 최신 AI 피드백 조회
|
* 매장 ID로 최신 AI 피드백 조회
|
||||||
*/
|
*/
|
||||||
@Query("SELECT af FROM AiFeedbackEntity af WHERE af.storeId = :storeId ORDER BY af.createdAt DESC LIMIT 1")
|
@Query("SELECT af FROM AiFeedbackEntity af WHERE af.storeId = :storeId ORDER BY af.generatedAt DESC LIMIT 1")
|
||||||
Optional<AiFeedbackEntity> findLatestByStoreId(@Param("storeId") Long storeId);
|
Optional<AiFeedbackEntity> findLatestByStoreId(@Param("storeId") Long storeId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -34,4 +34,10 @@ public class SignupRequest {
|
|||||||
@Pattern(regexp = "^010-\\d{4}-\\d{4}$", message = "전화번호 형식이 올바르지 않습니다")
|
@Pattern(regexp = "^010-\\d{4}-\\d{4}$", message = "전화번호 형식이 올바르지 않습니다")
|
||||||
@Schema(description = "전화번호", example = "010-1234-5678")
|
@Schema(description = "전화번호", example = "010-1234-5678")
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
|
|
||||||
|
@NotBlank(message = "역할분류는 필수입니다")
|
||||||
|
@Size(min = 2, max = 20, message = "역할분류는 2-20자 사이여야 합니다")
|
||||||
|
@Schema(description = "역할", example = "OWNER")
|
||||||
|
private String role;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,7 +45,7 @@ public class MemberServiceImpl implements MemberService {
|
|||||||
.password(passwordEncoder.encode(request.getPassword()))
|
.password(passwordEncoder.encode(request.getPassword()))
|
||||||
.nickname(request.getNickname())
|
.nickname(request.getNickname())
|
||||||
.phone(request.getPhone())
|
.phone(request.getPhone())
|
||||||
.role("USER")
|
.role(request.getRole())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
MemberEntity savedMember = memberRepository.save(member);
|
MemberEntity savedMember = memberRepository.save(member);
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import com.azure.messaging.eventhubs.EventData;
|
|||||||
import com.azure.messaging.eventhubs.EventDataBatch;
|
import com.azure.messaging.eventhubs.EventDataBatch;
|
||||||
import com.azure.messaging.eventhubs.EventHubClientBuilder;
|
import com.azure.messaging.eventhubs.EventHubClientBuilder;
|
||||||
import com.azure.messaging.eventhubs.EventHubProducerClient;
|
import com.azure.messaging.eventhubs.EventHubProducerClient;
|
||||||
|
import com.azure.messaging.eventhubs.models.CreateBatchOptions;
|
||||||
import com.azure.messaging.eventhubs.models.SendOptions;
|
import com.azure.messaging.eventhubs.models.SendOptions;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.ktds.hi.store.biz.usecase.in.ExternalIntegrationUseCase;
|
import com.ktds.hi.store.biz.usecase.in.ExternalIntegrationUseCase;
|
||||||
@ -68,6 +69,7 @@ public class ExternalIntegrationInteractor implements ExternalIntegrationUseCase
|
|||||||
throw new BusinessException("지원하지 않는 플랫폼입니다: " + request.getPlatform());
|
throw new BusinessException("지원하지 않는 플랫폼입니다: " + request.getPlatform());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.info(request.getPlatform() + " 요청 Data : " + request.toString());
|
||||||
// 동기화 이벤트 발행
|
// 동기화 이벤트 발행
|
||||||
publishSyncEvent(storeId, request.getPlatform(), syncedCount);
|
publishSyncEvent(storeId, request.getPlatform(), syncedCount);
|
||||||
|
|
||||||
@ -252,11 +254,10 @@ public class ExternalIntegrationInteractor implements ExternalIntegrationUseCase
|
|||||||
|
|
||||||
EventData eventData = new EventData(payloadJson);
|
EventData eventData = new EventData(payloadJson);
|
||||||
|
|
||||||
// 🔥 파티션 4번에 보내기 위한 SendOptions 설정
|
CreateBatchOptions batchOptions = new CreateBatchOptions();
|
||||||
SendOptions sendOptions = new SendOptions();
|
batchOptions.setPartitionId("4"); // 배치 전체의 파티션 고정
|
||||||
sendOptions.setPartitionId("4");
|
|
||||||
// EventDataBatch 사용
|
EventDataBatch batch = producer.createBatch(batchOptions); // 옵션 적용된 배치 생성
|
||||||
EventDataBatch batch = producer.createBatch();
|
|
||||||
if (batch.tryAdd(eventData)) {
|
if (batch.tryAdd(eventData)) {
|
||||||
producer.send(batch);
|
producer.send(batch);
|
||||||
log.info("동기화 이벤트 발행 성공: storeId={}, platform={}, syncedCount={}",
|
log.info("동기화 이벤트 발행 성공: storeId={}, platform={}, syncedCount={}",
|
||||||
|
|||||||
@ -98,6 +98,48 @@ public class StoreService implements StoreUseCase {
|
|||||||
public String getAllTags(Long storeId){
|
public String getAllTags(Long storeId){
|
||||||
return storeJpaRepository.findById(storeId).get().getTagsJson();
|
return storeJpaRepository.findById(storeId).get().getTagsJson();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<StoreListResponse> getSearchStoreName(String storeName){
|
||||||
|
List<StoreEntity> stores = storeJpaRepository.finByStoreNameContaining(storeName);
|
||||||
|
|
||||||
|
return stores.stream()
|
||||||
|
.map(store -> StoreListResponse.builder()
|
||||||
|
.storeId(store.getId())
|
||||||
|
.storeName(store.getStoreName())
|
||||||
|
.address(store.getAddress())
|
||||||
|
.category(store.getCategory())
|
||||||
|
.rating(store.getRating())
|
||||||
|
.reviewCount(store.getReviewCount())
|
||||||
|
.status("운영중")
|
||||||
|
.tagJson(store.getTagsJson())
|
||||||
|
.imageUrl(store.getImageUrl())
|
||||||
|
.operatingHours(store.getOperatingHours())
|
||||||
|
.build())
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<StoreListResponse> getCategoryStores(String category){
|
||||||
|
List<StoreEntity> stores = storeJpaRepository.findByCategory(category);
|
||||||
|
|
||||||
|
return stores.stream()
|
||||||
|
.map(store -> StoreListResponse.builder()
|
||||||
|
.storeId(store.getId())
|
||||||
|
.storeName(store.getStoreName())
|
||||||
|
.address(store.getAddress())
|
||||||
|
.category(store.getCategory())
|
||||||
|
.rating(store.getRating())
|
||||||
|
.reviewCount(store.getReviewCount())
|
||||||
|
.status("운영중")
|
||||||
|
.tagJson(store.getTagsJson())
|
||||||
|
.imageUrl(store.getImageUrl())
|
||||||
|
.operatingHours(store.getOperatingHours())
|
||||||
|
.build())
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<StoreListResponse> getAllStores() {
|
public List<StoreListResponse> getAllStores() {
|
||||||
|
|
||||||
|
|||||||
@ -33,6 +33,10 @@ public interface StoreUseCase {
|
|||||||
|
|
||||||
List<StoreListResponse> getAllStores();
|
List<StoreListResponse> getAllStores();
|
||||||
|
|
||||||
|
List<StoreListResponse> getCategoryStores(String category);
|
||||||
|
|
||||||
|
List<StoreListResponse> getSearchStoreName(String storeName);
|
||||||
|
|
||||||
String getAllTags(Long storeId);
|
String getAllTags(Long storeId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -59,6 +59,8 @@ public class StoreController {
|
|||||||
.body(ApiResponse.success(response, "매장이 성공적으로 등록되었습니다."));
|
.body(ApiResponse.success(response, "매장이 성공적으로 등록되었습니다."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Operation(summary = "내 매장 목록 조회", description = "점주가 등록한 매장 목록을 조회합니다.")
|
@Operation(summary = "내 매장 목록 조회", description = "점주가 등록한 매장 목록을 조회합니다.")
|
||||||
@GetMapping("/my")
|
@GetMapping("/my")
|
||||||
@PreAuthorize("hasRole('OWNER')")
|
@PreAuthorize("hasRole('OWNER')")
|
||||||
@ -71,6 +73,8 @@ public class StoreController {
|
|||||||
return ResponseEntity.ok(ApiResponse.success(responses, "내 매장 목록 조회 완료"));
|
return ResponseEntity.ok(ApiResponse.success(responses, "내 매장 목록 조회 완료"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/stores/all")
|
@GetMapping("/stores/all")
|
||||||
@Operation(summary = "매장 전체 리스트")
|
@Operation(summary = "매장 전체 리스트")
|
||||||
public ResponseEntity<ApiResponse<List<StoreListResponse>>> getAllStores() {
|
public ResponseEntity<ApiResponse<List<StoreListResponse>>> getAllStores() {
|
||||||
@ -79,6 +83,24 @@ public class StoreController {
|
|||||||
return ResponseEntity.ok(ApiResponse.success(responses));
|
return ResponseEntity.ok(ApiResponse.success(responses));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "매장 조회", description = "가게 검색한 매장 목록을 조회합니다.")
|
||||||
|
@GetMapping("/search/storeName/{storeName}")
|
||||||
|
public ResponseEntity<ApiResponse<List<StoreListResponse>>> getSearchStores(
|
||||||
|
HttpServletRequest httpRequest, @PathVariable String storeName) {
|
||||||
|
|
||||||
|
List<StoreListResponse> responses = storeUseCase.getSearchStoreName(storeName);
|
||||||
|
|
||||||
|
return ResponseEntity.ok(ApiResponse.success(responses));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/stores/category/{category}")
|
||||||
|
@Operation(summary = "카테고리에 해당하는 매장")
|
||||||
|
public ResponseEntity<ApiResponse<List<StoreListResponse>>> getStoreCategories(@PathVariable String category) {
|
||||||
|
|
||||||
|
List<StoreListResponse> responses = storeUseCase.getCategoryStores(category);
|
||||||
|
return ResponseEntity.ok(ApiResponse.success(responses));
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/stores/{storeId}/tags")
|
@GetMapping("/stores/{storeId}/tags")
|
||||||
@Operation(summary = "매장 전체 리스트")
|
@Operation(summary = "매장 전체 리스트")
|
||||||
public ResponseEntity<String> getStoreTags(@PathVariable Long storeId) {
|
public ResponseEntity<String> getStoreTags(@PathVariable Long storeId) {
|
||||||
|
|||||||
@ -82,7 +82,7 @@ public class ExternalPlatformAdapter implements ExternalPlatformPort {
|
|||||||
|
|
||||||
Map<String, Object> requestBody = new HashMap<>();
|
Map<String, Object> requestBody = new HashMap<>();
|
||||||
requestBody.put("store_id", externalStoreId);
|
requestBody.put("store_id", externalStoreId);
|
||||||
requestBody.put("days_limit", 1000);
|
requestBody.put("days_limit", 365);
|
||||||
requestBody.put("max_time", 300);
|
requestBody.put("max_time", 300);
|
||||||
|
|
||||||
HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
|||||||
@ -46,6 +46,8 @@ public interface StoreJpaRepository extends JpaRepository<StoreEntity, Long> {
|
|||||||
*/
|
*/
|
||||||
List<StoreEntity> findByCategory(String category);
|
List<StoreEntity> findByCategory(String category);
|
||||||
|
|
||||||
|
@Query("SELECT s FROM StoreEntity s WHERE s.storeName like %:storeName%")
|
||||||
|
List<StoreEntity> finByStoreNameContaining(@Param("storeName") String storeName);
|
||||||
/**
|
/**
|
||||||
* 상태로 매장 조회
|
* 상태로 매장 조회
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user