Conversation
Summary of ChangesHello @withJihyuk, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 PR은 공간 사용 내역 관리 시스템의 핵심 기능을 확장하고 개선하는 것을 목표로 합니다. 주요 변경 사항은 사용 내역에 대한 추가 인원 정보를 기록하는 기능 도입과, 이를 활용하여 공간별 월별 이용 현황을 연령 및 성별로 상세하게 집계하여 엑셀 파일로 내보내는 새로운 보고서 기능 추가입니다. 또한, 기존 엑셀 내보내기 로직은 더 유연하고 확장 가능한 구조로 전면 리팩토링되었습니다. 이로써 관리자는 공간 사용 데이터를 더욱 세밀하게 분석하고 활용할 수 있게 됩니다. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
이번 PR은 월별 이용 통계를 템플릿 기반의 Excel 파일로 내보내는 중요한 기능과, 공간 이용 시 추가 인원을 기록하는 기능을 구현했습니다.
전반적인 코드 품질이 높습니다. 특히 Excel 생성 로직을 단일 책임 원칙에 따라 작은 컴포넌트로 리팩토링한 점은 유지보수성 측면에서 매우 훌륭한 개선입니다. 또한 @ConfigurationProperties를 활용한 설정 관리나 성능 최적화를 위한 JOIN FETCH 사용도 좋은 선택입니다.
코드의 안정성과 유지보수성을 더욱 향상시키기 위해 몇 가지 제안 사항을 댓글로 남겼습니다. 파일명 오타 수정, 수식 파싱 로직 유연성 확보, 하드코딩된 값 제거 등에 대한 내용이니 검토 부탁드립니다.
| import org.aing.danurirest.domain.admin.usecase.GetUsageHistoriesUsecase | ||
| import org.aing.danurirest.domain.admin.usecase.GetUsageHistoryUsecase | ||
| import org.aing.danurirest.domain.admin.usecase.UpdateUsageHistoryUsecase | ||
| import org.aing.danurirest.domain.admin.usecase.* |
| import org.springframework.web.bind.annotation.RequestMapping | ||
| import org.springframework.web.bind.annotation.RestController | ||
| import org.springframework.validation.annotation.Validated | ||
| import org.springframework.web.bind.annotation.* |
| .ok() | ||
| .header("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") | ||
| .header("Content-Disposition", "attachment; filename=usage_history.xlsx") | ||
| .header("Content-Disposition", "attachment; filename=usage_history_.xlsx") |
There was a problem hiding this comment.
| fun updateFormula( | ||
| formula: String, | ||
| startRow: Int, | ||
| endRow: Int, | ||
| ): String = | ||
| formula.replace(Regex("SUM\\(([A-Z]+)\\d+:([A-Z]+)\\d+\\)")) { match -> | ||
| val column1 = match.groupValues[1] | ||
| val column2 = match.groupValues[2] | ||
| "SUM(${column1}$startRow:${column2}$endRow)" | ||
| } |
| try { | ||
| // 템플릿 로드 | ||
| val workbook = templateLoader.loadMonthlyUsageTemplate() | ||
| val sheet = workbook.getSheetAt(0) ?: throw CustomException(CustomErrorCode.UNKNOWN_SERVER_ERROR) |
| for (day in (daysInMonth + 1)..31) { | ||
| val rowIndex = properties.data.startRow + day - 1 | ||
| val row = sheet.getRow(rowIndex) | ||
| row?.let { clearRow(it) } | ||
| } | ||
|
|
||
| if (sheet.lastRowNum > properties.data.startRow + daysInMonth) { | ||
| sheet.shiftRows( | ||
| properties.data.startRow + 31, | ||
| sheet.lastRowNum, | ||
| -(31 - daysInMonth), | ||
| ) | ||
| } |
| private fun mapAgeOption(ageOption: String?): Age? = | ||
| when (ageOption) { | ||
| "초등학교" -> Age.ELEMENTARY | ||
| "중학교" -> Age.MIDDLE | ||
| "고등학교" -> Age.HIGH | ||
| "대학교" -> Age.COLLEGE | ||
| "학교 밖 청소년" -> Age.OUT_OF_SCHOOL_YOUTH | ||
| "성인/유아" -> Age.ADULT | ||
| else -> null | ||
| } |
There was a problem hiding this comment.
💡 JIRA TICKET
📃 작업내용
✅ PR 체크리스트
.env,노션,README)"API 개발 완료됐어요","환경값 추가되었어요")