1811872455@163.com 1 هفته پیش
والد
کامیت
1e3e9bfac0

+ 6 - 0
storlead-centre-api/src/main/java/com/storlead/centre/dispatch/AttendanceSignDispatchTask.java

@@ -2,6 +2,7 @@ package com.storlead.centre.dispatch;
 
 import com.storlead.centre.service.AttendanceSignRecordService;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
@@ -24,6 +25,8 @@ public class AttendanceSignDispatchTask {
     @Resource
     private AttendanceSignRecordService attendanceSignRecordService;
 
+    @Value("${environment}")
+    private  String environment;
     /**
      * 同步考勤数据
      * @throws ParseException
@@ -31,6 +34,9 @@ public class AttendanceSignDispatchTask {
     @Scheduled(cron ="0 * * * * ? ")
     public void syncSignData() throws ParseException {
 
+        if(!"prod".equals(environment)) {
+            return;
+        }
         LocalTime now = LocalTime.now();
 
         // ===== 总时间窗:06:00 – 22:30 =====

+ 8 - 0
storlead-centre-api/src/main/java/com/storlead/centre/dispatch/SyncAttendanceSignToOaTask.java

@@ -14,6 +14,7 @@ import com.storlead.centre.service.HrmschedulesignService;
 import com.storlead.centre.service.SystemConfigItemService;
 import com.storlead.centre.vo.SignDataConvert;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 import org.springframework.util.CollectionUtils;
@@ -44,9 +45,16 @@ public class SyncAttendanceSignToOaTask {
     @Resource
     private SystemConfigItemService systemConfigItemService;
 
+    @Value("${environment}")
+    private  String environment;
+
     @Scheduled(cron ="0 * * * * ? ")
     public void syncSignData() throws ParseException {
 
+        if(!"prod".equals(environment)) {
+            return;
+        }
+
         LocalTime now = LocalTime.now();
         // ===== 总时间窗:06:00 – 22:30 =====
         if (now.isBefore(LocalTime.of(6, 0))