Skip to content

Commit

Permalink
[DEL] 사용하지 않는 import 문 및 log 삭제
Browse files Browse the repository at this point in the history
  • Loading branch information
devyubin committed Oct 1, 2023
1 parent 4b977c8 commit ee39c77
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ public ResponseEntity<BaseResponse> deleteSchedule(@PathVariable Long scheduleId
public ResponseEntity<BaseResponse> updateSchedule(@PathVariable Long scheduleId, @RequestBody ScheduleRequestDto requestDto) {
try {
Schedule updateSchedule = scheduleService.updateSchedule(scheduleId, requestDto);
log.debug("requestDto.getPlace() = {}",requestDto.getPlace());

// 맵 API 호출하여 맵 URL 얻어오는 부분
String mapUrlString = mapService.getMapUrl(requestDto.getPlace());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,10 @@ public String getMapUrl(String reqLocation) throws BaseException {
String address = reqLocation;
String addr = URLEncoder.encode(address, "UTF-8");

log.debug("address = {}", address);

// Geocoding 개요에 나와있는 API URL 입력.
String apiURL = "https://dapi.kakao.com/v2/local/search/keyword.json?page=1&size=1&sort=accuracy&query="+addr;

URL url = new URL(apiURL);
log.debug("url = {}", url);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("GET");

Expand Down Expand Up @@ -64,23 +61,16 @@ public String getMapUrl(String reqLocation) throws BaseException {
br.close();

ObjectMapper objectMapper = new ObjectMapper();
log.debug("response = {} response.string = {}", response, response.toString());

JsonNode jsonNode = objectMapper.readTree(response.toString());
log.debug("jsonNode = {}", jsonNode);
JsonNode itemsNode = jsonNode.get("documents");
log.debug("documents = {}", itemsNode);

if (itemsNode != null && itemsNode.isArray() && itemsNode.size() > 0) {
JsonNode firstItem = itemsNode.get(0);
String mapx = firstItem.get("y").asText();
String mapy = firstItem.get("x").asText();

log.debug("mapx = {} and mapy = {}", mapx, mapy);
resultUrl = "nmap://route/public?dlat=" + mapx + "&dlng=" + mapy + "&dname=" + addr;
}
} catch (UnsupportedEncodingException e) { // 에러가 발생했을 때 예외 status 명시
log.debug("UnKnownAddrException 발생 ");
} catch (UnsupportedEncodingException e) {
throw new BaseException(ResponseStatus.UNKNOWN_ADDR);
} catch (ProtocolException e) {
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,13 @@
import com.haemil.backend.schedule.entity.RepeatType;
import com.haemil.backend.schedule.entity.Schedule;
import com.haemil.backend.schedule.repository.ScheduleRepository;
//import com.haemil.backend.schedule.repository.SpringDataJpaScheduleRepository;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.haemil.backend.global.config.ResponseStatus;

import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.List;
import java.util.Optional;

Expand Down Expand Up @@ -162,7 +155,6 @@ public Schedule updateSchedule(Long id, ScheduleRequestDto requestDto) {
// 여기서 중복 일정 검사를 수행하고 이미 존재하는 경우 예외를 던짐
List<Schedule> existingSchedules = scheduleRepository.findByLocalDate(newLocalDate);
for (Schedule existingSchedule : existingSchedules) {
System.out.println("existingSchedule: " + existingSchedule);
if (
existingSchedule.getDayOfWeek() == newDayOfWeek &&
existingSchedule.getTime().equals(newTime) &&
Expand All @@ -183,8 +175,6 @@ public Schedule updateSchedule(Long id, ScheduleRequestDto requestDto) {
schedule.setRepeatType(newRepeatType);
schedule.setMedicine(newMedicine);

log.debug("newContent = {}", newContent);

return scheduleRepository.save(schedule);

} catch (MissingRequiredFieldException e) {
Expand Down

0 comments on commit ee39c77

Please sign in to comment.