Skip to content

Commit

Permalink
fix: 리뷰 반영
Browse files Browse the repository at this point in the history
  • Loading branch information
dradnats1012 committed Oct 6, 2024
1 parent 6ca0bd1 commit 7330ea0
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ ResponseEntity<CoopLoginResponse> coopLogin(

@ApiResponses(
value = {
@ApiResponse(responseCode = "201"),
@ApiResponse(responseCode = "200"),
@ApiResponse(responseCode = "400", content = @Content(schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "403", content = @Content(schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "404", content = @Content(schema = @Schema(hidden = true))),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import in.koreatech.koin.domain.coop.dto.SoldOutRequest;
import in.koreatech.koin.domain.coop.service.CoopService;
import in.koreatech.koin.global.auth.Auth;
import io.swagger.v3.oas.annotations.Parameter;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;

Expand Down Expand Up @@ -63,12 +64,15 @@ public ResponseEntity<CoopLoginResponse> coopLogin(

@GetMapping("/dining/excel")
public ResponseEntity<InputStreamResource> generateCoopExcel(
@RequestParam("startDate") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate startDate,
@RequestParam("endDate") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate endDate,
@Parameter(description = "시작일 (형식: yyyy-MM-dd)", example = "2024-01-03")
@RequestParam("startDate") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE)
LocalDate startDate,
@Parameter(description = "시작일 (형식: yyyy-MM-dd)", example = "2024-01-10")
@RequestParam("endDate") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE)
LocalDate endDate,
@RequestParam(name = "isCafeteria", defaultValue = "false") Boolean isCafeteria
) {
ByteArrayInputStream excelFile = coopService.generateCoopExcel(startDate, endDate, isCafeteria);
ByteArrayInputStream excelFile = coopService.generateDiningExcel(startDate, endDate, isCafeteria);
return ExcelResponseBuilder.buildExcelResponse(excelFile, startDate, endDate);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public CoopLoginResponse coopLogin(CoopLoginRequest request) {
return CoopLoginResponse.of(accessToken, savedToken.getRefreshToken());
}

public ByteArrayInputStream generateCoopExcel(LocalDate startDate, LocalDate endDate, Boolean isCafeteria) {
public ByteArrayInputStream generateDiningExcel(LocalDate startDate, LocalDate endDate, Boolean isCafeteria) {
List<Dining> dinings;

if(isCafeteria) {
Expand All @@ -122,7 +122,6 @@ public ByteArrayInputStream generateCoopExcel(LocalDate startDate, LocalDate end
dinings = diningRepository.findByDateBetween(startDate, endDate);
}


try (Workbook workbook = new XSSFWorkbook()) {
Sheet sheet = workbook.createSheet("식단 메뉴");

Expand All @@ -144,7 +143,7 @@ private ByteArrayInputStream putDiningData(List<Dining> dinings, Sheet sheet, Ce
dinings.forEach(dining -> {
Row row = sheet.createRow(rowIdx.getAndIncrement());
row.createCell(0).setCellValue(dining.getDate().toString());
row.createCell(1).setCellValue(dining.getType().toString());
row.createCell(1).setCellValue(dining.getType().getDiningName());
row.createCell(2).setCellValue(dining.getPlace());
row.createCell(3).setCellValue(dining.getKcal() != null ? dining.getKcal() : 0);

Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<configuration>
<springProperty scope="context" name="SLACK_WEBHOOK_URI" source="slack.logging.error"/>
<!--<springProperty scope="context" name="SLACK_WEBHOOK_URI" source="slack.logging.error"/>-->
<property name="defaultLogPattern"
value="[%d{yyyy-MM-dd'T'HH:mm:ss.SSS}] %-5level --- [%15.15thread] %-40.40logger{36} : %msg%n"/>
<property name="consoleLogPattern"
Expand Down Expand Up @@ -37,7 +37,7 @@
</appender>

<appender name="SLACK" class="com.github.maricn.logback.SlackAppender">
<webhookUri>${SLACK_WEBHOOK_URI}</webhookUri>
<!--<webhookUri>${SLACK_WEBHOOK_URI}</webhookUri>-->
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>${slackLogPattern}</pattern>
</layout>
Expand Down

0 comments on commit 7330ea0

Please sign in to comment.