Skip to content

Commit

Permalink
RAC-401 feat : 관리자 페이지 수동 배치 실행 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
ywj9811 committed Jun 20, 2024
1 parent 2d36e28 commit ac8812e
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.postgraduate.admin.application.usecase;

import com.postgraduate.batch.scheduler.JobSchedulerConfig;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Service
@Slf4j
@RequiredArgsConstructor
public class AdminBatchUseCase {
private final JobSchedulerConfig jobSchedulerConfig;

public void startSalaryBatch() {
try {
jobSchedulerConfig.launchSalaryJob();
} catch (Exception e) {
log.error("Create Salary Batch Exception : {}", e.getStackTrace());
}
}

public void startMentoringDoneBatch() {
try {
jobSchedulerConfig.launchDoneJob();
} catch (Exception e) {
log.error("Create Salary Batch Exception : {}", e.getStackTrace());
}
}

public void startMentoringCancelBatch() {
try {
jobSchedulerConfig.launchCancelJob();
} catch (Exception e) {
log.error("Create Salary Batch Exception : {}", e.getStackTrace());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class AdminWithThymeLeafController {
private final AdminMentoringUseCase adminMentoringUseCase;
private final AdminSalaryUseCase adminSalaryUseCase;
private final AdminPaymentUseCase adminPaymentUseCase;
private final AdminBatchUseCase adminBatchUseCase;
private final JwtUseCase jwtUseCase;

@GetMapping("/loginForm")
Expand Down Expand Up @@ -166,4 +167,27 @@ public String sendMessage(@RequestBody SendMessageRequest messageRequest) {
adminUserUseCase.sendMatchingMessage(messageRequest);
return "adminEmpty";
}

@GetMapping("/batch")
public String batchManage() {
return "adminBatch";
}

@PostMapping("/batch/salary")
public String startSalaryBatch() {
adminBatchUseCase.startSalaryBatch();
return "adminEmpty";
}

@PostMapping("/batch/mentoring/done")
public String startMentoringDone() {
adminBatchUseCase.startMentoringDoneBatch();
return "adminEmpty";
}

@PostMapping("/batch/mentoring/cancel")
public String startMentoringCancel() {
adminBatchUseCase.startMentoringCancelBatch();
return "adminEmpty";
}
}
42 changes: 42 additions & 0 deletions src/main/resources/templates/adminBatch.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8">
<link th:href="@{/css/bootstrap.min.css}" href="css/bootstrap.min.css" rel="stylesheet">
<style>
.outer {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
width: 100%;
padding-top: 30px;
}

.inner {
text-align: center;
}

label, input {
display: block;
margin: 0 auto 10px;
}

input {
margin-top: 10px;
}
</style>
</head>
<body>
<div class="outer">
<div class="inner">
<label><h1>정산 자동 생성 배치 재시도</h1></label>
<button th:onclick="goToPost('정산 자동 생성 배치를 재시도 하시겠습니까?', '/adminServer/batch/salary')"><h3>정산 자동 생성</h3></button>
<label><h1>멘토링 자동 완료 배치 재시도</h1></label>
<button th:onclick="goToPost('정산 자동 생성 배치를 재시도 하시겠습니까?', '/adminServer/batch/mentoring/done')"><h3>멘토링 자동 완료</h3></button>
<label><h1>멘토링 자동 취소 배치 재시도</h1></label>
<button th:onclick="goToPost('정산 자동 생성 배치를 재시도 하시겠습니까?', '/adminServer/batch/mentoring/cancel')"><h3>멘토링 자동 취소</h3></button>
</div>
</div>
</body>
</html>
8 changes: 8 additions & 0 deletions src/main/resources/templates/adminMain.html
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@
type="button">알림톡 전송</button>
</div>
</div>

<div class="row">
<div class="col">
<button class="w-100 btn btn-primary btn-lg"
onclick="goToGet('/adminServer/batch')"
type="button">배치 재시도 -주의- 개발팀 담당</button>
</div>
</div>
</div>
<div id="output" class="center">
<!-- 서버에서 받은 데이터가 여기에 표시됩니다. -->
Expand Down

0 comments on commit ac8812e

Please sign in to comment.