From 4609279f58cde91617f10c54fd40be32627b18e0 Mon Sep 17 00:00:00 2001 From: lyutvs Date: Thu, 30 Mar 2023 22:29:59 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=80=20::=20excel=20=EA=B0=84=EA=B2=A9?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD=20=EB=B0=8F=20=EC=83=81=EB=B2=8C=EC=A0=90?= =?UTF-8?q?=20=EB=8B=A8=EA=B3=84=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xquare/v1servicepoint/point/spi/ExcelSpiImpl.kt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/point-infrastructure/src/main/kotlin/com/xquare/v1servicepoint/point/spi/ExcelSpiImpl.kt b/point-infrastructure/src/main/kotlin/com/xquare/v1servicepoint/point/spi/ExcelSpiImpl.kt index eafc0e6..f1e584c 100644 --- a/point-infrastructure/src/main/kotlin/com/xquare/v1servicepoint/point/spi/ExcelSpiImpl.kt +++ b/point-infrastructure/src/main/kotlin/com/xquare/v1servicepoint/point/spi/ExcelSpiImpl.kt @@ -18,7 +18,7 @@ class ExcelSpiImpl( ) : ExcelSpi { override suspend fun writeUserPointHistoryExcelFile(): ByteArray { - val attributes = listOf("학번", "이름", "상점", "벌점", "상점내역", "벌점내역", "교육 단계") + val attributes = listOf("학번", "이름", "상점", "벌점", "상점내역", "벌점내역", "교육 단계", "교육 필요 여부") val pointStatus = pointStatusSpi.findAll() val userPointStatus = userSpi.getStudent() val goodPointHistories = pointHistorySpi.findAllByType(true) @@ -44,12 +44,18 @@ class ExcelSpiImpl( userStatus.badPoint.toString(), goodPointHistoryString.replace(Regex("[\\[\\]]"), ""), badPointHistoryString.replace(Regex("[\\[\\]]"), ""), + userStatus.penaltyLevel.toString(), + convertPenaltyRequiredToString(userStatus.isPenaltyRequired), ) }.sortedBy { it[0] } // 학번순으로 정렬 return createExcelSheet(attributes, userData, "학생 상벌점 내역") } + private fun convertPenaltyRequiredToString(isPenaltyRequired: Boolean): String { + return if (isPenaltyRequired) "필요" else "필요 없음" + } + private fun createExcelSheet( attributes: List, dataList: List>, @@ -70,8 +76,9 @@ class ExcelSpiImpl( sheet.setColumnWidth(1, 7 * 256) sheet.setColumnWidth(2, 5 * 256) sheet.setColumnWidth(3, 5 * 256) - sheet.setColumnWidth(4, 37 * 256) - sheet.setColumnWidth(5, 37 * 256) + sheet.setColumnWidth(4, 45 * 256) + sheet.setColumnWidth(5, 45 * 256) + sheet.setColumnWidth(6, 10 * 256) ByteArrayOutputStream().use { stream -> workbook.write(stream)