Skip to content

Commit

Permalink
Merge pull request #35 from Imsyp/main
Browse files Browse the repository at this point in the history
feat: architecture change date : price -> date,time : price
  • Loading branch information
Imsyp authored Sep 27, 2024
2 parents 289f325 + e2c5876 commit d26c441
Show file tree
Hide file tree
Showing 15 changed files with 10 additions and 50 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified server/build/tmp/compileJava/previous-compilation-data.bin
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

package com.swdc.server.controller;

import com.swdc.server.domain.mongoDB.Price;
import com.swdc.server.domain.Storage.Price;
import com.swdc.server.service.PriceService;
import jakarta.servlet.http.HttpServletRequest;
import lombok.RequiredArgsConstructor;
Expand All @@ -22,7 +22,6 @@ public class PriceController {

private final PriceService priceService;


/**
*
* 플랫폼 이름, 카테고리 이름, 상품 id를 이용하여 priceService의 getProductDetails를 호출
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
*/

package com.swdc.server.domain.mongoDB;
package com.swdc.server.domain.Storage;

import lombok.Builder;
import lombok.Getter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
*/

package com.swdc.server.domain.mongoDB;
package com.swdc.server.domain.Storage;

import lombok.Getter;
import lombok.NoArgsConstructor;
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

package com.swdc.server.service;

import com.swdc.server.domain.mongoDB.Price;
import com.swdc.server.domain.Storage.Price;
import lombok.RequiredArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -53,7 +53,12 @@ public Price getProductDetails(String platform, String category_name, String pro
try (BufferedReader bufferedReader = Files.newBufferedReader(productPath)) {
prices = bufferedReader.lines()
.map(line -> line.split(",")) // 각 줄을 쉼표로 분리
.map(parts -> Map.of(parts[0], Integer.parseInt(parts[1]))) // 날짜와 가격을 Map으로 변환
.map(parts -> {
// 날짜와 시간 부분을 키로, 가격을 값으로 맵 구성
String dateTime = parts[0] + "," + parts[1]; // "2024-09-20,09:00" 형태
int price = Integer.parseInt(parts[2]); // "8000"을 정수로 변환
return Map.of(dateTime, price); // Map<String, Integer> 생성
})
.collect(Collectors.toList()); // 모든 맵을 리스트로 수집
} catch (FileNotFoundException e) {
System.err.println("File not found: " + productPath + ". Error: " + e.getMessage());
Expand Down

0 comments on commit d26c441

Please sign in to comment.