wangyunpeng преди 1 година
родител
ревизия
48fbe4e7b5
променени са 1 файла, в които са добавени 4 реда и са изтрити 3 реда
  1. 4 3
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/XxlJobService.java

+ 4 - 3
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/XxlJobService.java

@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
 
+import java.time.LocalTime;
 import java.util.List;
 
 @Service
@@ -30,9 +31,9 @@ public class XxlJobService {
             if (!StringUtils.hasText(publishPlan.getPublishWindowStart())) {
                 continue;
             }
-            String[] planTime = publishPlan.getPublishWindowStart().split(":");
-            int planHour = Integer.parseInt(planTime[0]);
-            int planMinute = Integer.parseInt(planTime[1]);
+            LocalTime time = LocalTime.parse(publishPlan.getPublishWindowStart());
+            int planHour = time.getHour();
+            int planMinute = time.getMinute();
             if (nowHour - planHour == 1 && nowMinute > planMinute) {
                 sendFeishuPublishPlanNotPushWarn(publishPlan);
             } else if (nowHour - planHour > 1) {