From ac8812e7963421c2d1c36c1fb8d3c3e03db55943 Mon Sep 17 00:00:00 2001 From: yang Date: Fri, 21 Jun 2024 03:31:24 +0900 Subject: [PATCH] =?UTF-8?q?RAC-401=20feat=20:=20=EA=B4=80=EB=A6=AC?= =?UTF-8?q?=EC=9E=90=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=88=98=EB=8F=99=20?= =?UTF-8?q?=EB=B0=B0=EC=B9=98=20=EC=8B=A4=ED=96=89=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../usecase/AdminBatchUseCase.java | 37 ++++++++++++++++ .../AdminWithThymeLeafController.java | 24 +++++++++++ src/main/resources/templates/adminBatch.html | 42 +++++++++++++++++++ src/main/resources/templates/adminMain.html | 8 ++++ 4 files changed, 111 insertions(+) create mode 100644 src/main/java/com/postgraduate/admin/application/usecase/AdminBatchUseCase.java create mode 100644 src/main/resources/templates/adminBatch.html diff --git a/src/main/java/com/postgraduate/admin/application/usecase/AdminBatchUseCase.java b/src/main/java/com/postgraduate/admin/application/usecase/AdminBatchUseCase.java new file mode 100644 index 00000000..04aff989 --- /dev/null +++ b/src/main/java/com/postgraduate/admin/application/usecase/AdminBatchUseCase.java @@ -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()); + } + } +} diff --git a/src/main/java/com/postgraduate/admin/presentation/AdminWithThymeLeafController.java b/src/main/java/com/postgraduate/admin/presentation/AdminWithThymeLeafController.java index 37812f9d..fccb790b 100644 --- a/src/main/java/com/postgraduate/admin/presentation/AdminWithThymeLeafController.java +++ b/src/main/java/com/postgraduate/admin/presentation/AdminWithThymeLeafController.java @@ -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") @@ -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"; + } } diff --git a/src/main/resources/templates/adminBatch.html b/src/main/resources/templates/adminBatch.html new file mode 100644 index 00000000..64c941d6 --- /dev/null +++ b/src/main/resources/templates/adminBatch.html @@ -0,0 +1,42 @@ + + + + + + + + +
+
+ + + + + + +
+
+ + \ No newline at end of file diff --git a/src/main/resources/templates/adminMain.html b/src/main/resources/templates/adminMain.html index 098273aa..6e7da635 100644 --- a/src/main/resources/templates/adminMain.html +++ b/src/main/resources/templates/adminMain.html @@ -123,6 +123,14 @@ type="button">알림톡 전송 + +
+
+ +
+