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

[#3] 약국 및 병원 데이터 가져오기 #4

Merged
merged 8 commits into from
Aug 27, 2024
Merged

[#3] 약국 및 병원 데이터 가져오기 #4

merged 8 commits into from
Aug 27, 2024

Conversation

JHwan96
Copy link
Collaborator

@JHwan96 JHwan96 commented Aug 26, 2024

  • 공공데이터인 약국 정보 서비스, 병원 정보 서비스 가져오기 [건강보험심사평가원]
  • 의료기관별 상세 정보 [건강보험심사평가원]
    • 데이터 내부 문제로 처리 방법을 다시 생각해볼 예정

- spring boot starter web 추가
- AppTest 내용 임시 삭제
- 컨트롤러 생성을 위해 더미데이터 추가
- 임시 확인을 위해 main문 추가 (차후 main문 삭제 후 component로 변경할 예정)
- 값이 없는 경우는 null로 대체
- 서비스 키 제거 후 commit
- 차후 코드 리팩토링 및 DrugstoreDto 반환하도록 변경할 예정
- 임시 확인을 위해 main문 추가 (차후 main문 삭제 후 component로 변경할 예정)
- 값이 없는 경우는 null로 대체
- 특정 개수만큼 읽을 때, 전체 페이지 개수 반환하는 메서드 추가
- 예외 처리는 차후에 작업할 예정
@JHwan96 JHwan96 requested a review from f-lab-lyan August 26, 2024 10:53
@JHwan96 JHwan96 merged commit 4f9ae92 into main Aug 27, 2024
1 check passed
@Component
public class DrugstoreApi {
@Autowired
KeyInfo keyInfo;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Autowired대신 Contructor injection을 사용해 주세요.

private final int rowSize = 1000; //한 페이지 결과 수
private String url;

@PostConstruct
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PostContruct말고 다른 방식으로 변수를 초기화 하면 좋을 것 같습니다.

public List<DrugstoreDto> getDrugstoreInfo(int pageNo) throws IOException, ParserConfigurationException, SAXException {
List<DrugstoreDto> drugstoreDtoList = new ArrayList<>();
String realUrl = url + page + pageNo;
System.out.println(keyInfo.getServerKey());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logger를 적용해주세요.

Node node = nodeList.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE) {
Element element = (Element) node;
DrugstoreDto drugstoreDto = DrugstoreDto.builder()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기는 빌더가 유리한 판단인가요?

@JHwan96 JHwan96 self-assigned this Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants