Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #72

Merged
merged 2 commits into from
May 1, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public class PublicDataService {
private final RestTemplate restTemplate;
private final ObjectMapper mapper;
private final PostService postService;
private final CoordinateService coordinateService;
private final DistrictPort districtPort;

public List<GetLinearResponse> getLinearResponses(int dataIndex) {
Expand Down Expand Up @@ -107,9 +106,6 @@ public List<GetGeometryResponse> parsingCoordinate(int dataIndex) {
ObjectMapper mapper = new ObjectMapper();
List<GetGeometryResponse> responses = new ArrayList<>();
try {
// Path geoJsonPath = new ClassPathResource(geoJsonPathString).getFile().toPath();
// String jsonContent = Files.readString(geoJsonPath);
// FeatureCollection featureCollection = mapper.readValue(jsonContent, FeatureCollection.class);
InputStream inputStream = new ClassPathResource(geoJsonPathString).getInputStream();
String jsonContent = new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
FeatureCollection featureCollection = mapper.readValue(jsonContent, FeatureCollection.class);
Expand Down Expand Up @@ -155,7 +151,8 @@ public void addPublicData(int dataIndex){

String district = getCourseResponse.getDistrict();
int commaIndex = district.indexOf(','); // 쉼표 위치 찾기

System.out.println("dataIndex" + dataIndex);
System.out.println(getLinearResponse.getName());
if (commaIndex != -1) {
district = district.substring(0, commaIndex); // 쉼표 이전까지 문자열 자르기
}
Expand All @@ -164,16 +161,14 @@ public void addPublicData(int dataIndex){
Long id = byName.getId(); // District ID 가져오기

// 데이터베이스에 Post 추가
Post post = postService.addPost(new AddPostRequest(
postService.addPost(new AddPostRequest(
Category.DODREAM, getGeometryResponse.getName(), getCourseResponse.getSubTitle(),
safeSubstring(getCourseResponse.getDescription(), 0, 255),
getCourseResponse.getLevel(), getCourseResponse.getTime(),
getCourseResponse.getDistance(), safeSubstring(getCourseResponse.getCourseDetail(), 0 ,255),
getCourseResponse.getTransportation(), id, getGeometryResponse));

// if (post != null){
// coordinateService.saveCoordinate(getGeometryResponse, post);
// }

}
}
}
Expand Down