From 567e3003494f2a1ea56591299fc46575b7cb3965 Mon Sep 17 00:00:00 2001
From: 이민희 <mhlee@maprex.co.kr>
Date: 월, 27 12월 2021 19:36:01 +0900
Subject: [PATCH] 스케줄러 on/off 기능

---
 src/main/java/kr/wisestone/owl/scheduler/Scheduler.java |   39 +++++++++++++++++++++++++++++++--------
 1 files changed, 31 insertions(+), 8 deletions(-)

diff --git a/src/main/java/kr/wisestone/owl/scheduler/Scheduler.java b/src/main/java/kr/wisestone/owl/scheduler/Scheduler.java
index e4306e1..7a3417e 100644
--- a/src/main/java/kr/wisestone/owl/scheduler/Scheduler.java
+++ b/src/main/java/kr/wisestone/owl/scheduler/Scheduler.java
@@ -6,6 +6,7 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
@@ -15,7 +16,7 @@
 @Component
 public class Scheduler {
 
-    /*private static final Logger log = LoggerFactory.getLogger(Scheduler.class);
+    private static final Logger log = LoggerFactory.getLogger(Scheduler.class);
 
     @Autowired
     private PaymentService paymentService;
@@ -38,9 +39,15 @@
     @Autowired
     private WebSocketService webSocketService;
 
+    @Value("${use.scheduler}")
+    private boolean bUseScheduler;
+
     //  OWL ITS 愿��젴�옄�뱾�뿉寃� �쉶�썝 媛��엯 �젙蹂대�� �쟾�떖�븳�떎.
     @Scheduled(cron = "0 0 17 * * *")
     public void sendOwlManager() {
+        if (!bUseScheduler) {
+            return;
+        }
         //  OWL ITS 愿��젴�옄�뱾�뿉寃� �쉶�썝 媛��엯 �젙蹂대�� �쟾�떖�븳�떎.
         this.userService.sendUserJoinStatisticsEmail();
 
@@ -48,25 +55,28 @@
         this.userService.sendTotalStatisticsEmail();
     }
 
-    @Scheduled(cron = "0 50 23 * * *")    //  留� �떆媛� (珥�, 遺�, �떆, �씪, �썡, �뀈)
+    /*@Scheduled(cron = "0 50 23 * * *")    //  留� �떆媛� (珥�, 遺�, �떆, �씪, �썡, �뀈)
     public void updateExchangeRatePayment() {
         //  蹂�寃쎈맂 �솚�쑉 �젙蹂대�� 寃곗젣 湲덉븸�뿉 �뾽�뜲�씠�듃�븳�떎.
         this.paymentService.updateExchangeRatePayment();
-    }
+    }*/
 
     //   �옄�룞 寃곗옱 - �뼱�젣媛� 留뚮즺�씪�씤 �뾽臾� 怨듦컙�쓣 李얠븘�꽌 寃곗젣�븳�떎. �깉踰� 1�떆�뿉 �떎�뻾
-    @Scheduled(cron = "0 0 01 * * *")    //  留� �떆媛� (珥�, 遺�, �떆, �씪, �썡, �뀈)
+    /*@Scheduled(cron = "0 0 01 * * *")    //  留� �떆媛� (珥�, 遺�, �떆, �씪, �썡, �뀈)
     public void subscribePayment() {
         List<Workspace> workspaces = this.workspaceService.findSubscribeImmediateExpireDate();
 
         for (Workspace workspace : workspaces) {
             this.paymentService.subscribeImmediate(workspace);
         }
-    }
+    }*/
 
     //  �씠�뒋�� �뿰寃곕릺吏� �븡�� 泥⑤��뙆�씪 �궘�젣 - �씠�뒋 �깮�꽦, �닔�젙�뿉�꽌 �뿉�뵒�듃 李쎌뿉 泥⑤��뻽�떎媛� ���옣�븯吏� �븡�� �뙆�씪�뱾... �깉踰� 1�떆 30遺꾩뿉 �떎�뻾
     @Scheduled(cron = "0 30 01 * * *")
     public void deleteAttachedFileNotIdAndReservationIssue() {
+        if (!bUseScheduler) {
+            return;
+        }
         //  �씠�뒋�� �뿰寃곕릺吏� �븡�� 泥⑤��뙆�씪 �궘�젣
         this.attachedFileService.deleteAttachedFileNotId();
         //  �씠�뒋 �삁�빟 諛쒖깮�븳 �빆紐⑹쓣 李얠븘 �씠�뒋瑜� �떎�떆 �깮�꽦 �긽�깭濡� 蹂�寃쏀븳�떎.
@@ -74,23 +84,36 @@
     }
 
     //  �뾽臾� 怨듦컙 �옄�룞 珥덇린�솕 - �뼱�젣媛� 留뚮즺�씪�씤 �뾽臾� 怨듦컙�쓣 李얠븘�꽌 �뾽臾� 怨듦컙 �궗�슜�옄, �궗�슜 �슜�웾�쓣 珥덇린�솕�븳�떎. �깉踰� 2�떆�뿉 �떎�뻾
-    @Scheduled(cron = "0 0 02 * * *")
+    /*@Scheduled(cron = "0 0 02 * * *")
     public void expireWorkspace() {
         //  �궗�슜 湲곌컙�씠 留뚮즺�맂 �뾽臾� 怨듦컙�쓣 李얠븘 �슜�웾, 理쒕� �궗�슜�옄, �꽌鍮꾩뒪 �쑀�삎�쓣 蹂�寃쏀븳�떎.
         this.workspaceService.expireWorkspace();
         //  �뾽臾� 怨듦컙 留뚮즺 �삁�젙 �븞�궡
         this.workspaceService.expireAlarmWorkspace();
-    }
+    }*/
 
     //  �씠硫붿씪 �삁�빟 諛쒖넚 - �궗�슜�옄媛� �꽕�젙�븳 �븣由� �떆媛꾩뿉 �떆�뒪�뀥�뿉�꽌 �씪�뼱�궃 �씠踰ㅽ듃瑜� �씠硫붿씪濡� 諛쒖넚�븳�떎. - 留ㅼ떆媛� 30遺꾩뿉 �떎�뻾
     @Scheduled(cron = "0 0/30 * * * *")
     public void smartEmailSystem() {
+        if (!bUseScheduler) {
+            return;
+        }
         //  �삁�빟�맂 �씠硫붿씪 諛쒖넚
         this.systemEmailService.reservationSendEmail();
     }
 
+    //  �씠硫붿씪 �떎�떆媛� 諛쒖넚 - 1遺꾨쭏�떎 �떎�뻾
+    @Scheduled(cron = "0 * * * * *")
+    public void realTimeEmailSystem() {
+        if (!bUseScheduler) {
+            return;
+        }
+        //  �떎�떆媛� �씠硫붿씪 諛쒖넚
+        this.systemEmailService.realTimeSendEmail();
+    }
+
     //  15珥� 留덈떎 �젒�냽�옄 �솗�씤
-    @Scheduled(fixedDelay = 15000)
+    /*@Scheduled(fixedDelay = 15000)
     public void pingUsers() {
         //  �젒�냽 �궗�슜�옄瑜� �솗�씤�븳�떎.
         this.webSocketService.checkActiveUser();

--
Gitblit v1.8.0