xueyiming hai 8 meses
pai
achega
cd0f590252

+ 14 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/common/constant/TimeConstant.java

@@ -0,0 +1,14 @@
+package com.tzld.longarticle.recommend.server.common.constant;
+
+public interface TimeConstant {
+
+    Integer MINUTE = 60;
+    Integer HOUR = 60 * 60;
+    Integer DAY = 60 * 60 * 24;
+
+    Long MILLISECOND_HOUR = (long) HOUR * 1000;
+
+    Long MILLISECOND_DAY = (long) DAY * 1000;
+
+
+}

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

@@ -45,6 +45,9 @@ import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
 
+import static com.tzld.longarticle.recommend.server.common.constant.TimeConstant.MILLISECOND_DAY;
+import static com.tzld.longarticle.recommend.server.common.constant.TimeConstant.MILLISECOND_HOUR;
+
 @Service
 @Slf4j
 public class XxlJobService {
@@ -302,9 +305,9 @@ public class XxlJobService {
     @XxlJob("alertPushMessageJob")
     public ReturnT<String> alertPushMessageJob(String param) {
         long endTimestamp = System.currentTimeMillis();
-        long startTimestamp = endTimestamp - 1000 * 60 * 60;
-        long ytdStartTimestamp = startTimestamp - 1000 * 60 * 60 * 24;
-        long ytdEndTimestamp = endTimestamp - 1000 * 60 * 60 * 24;
+        long startTimestamp = endTimestamp - MILLISECOND_HOUR;
+        long ytdStartTimestamp = startTimestamp - MILLISECOND_DAY;
+        long ytdEndTimestamp = endTimestamp - MILLISECOND_DAY;
         PushMessageCallbackExample example = new PushMessageCallbackExample();
         example.createCriteria().andCreateTimeBetween(new Date(startTimestamp), new Date(endTimestamp));
         long nowCount = pushMessageCallbackMapper.countByExample(example);