yumeng 10 miesięcy temu
rodzic
commit
165da46821

+ 43 - 8
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/JiaoYangFenXiaoJob.java

@@ -118,6 +118,48 @@ public class JiaoYangFenXiaoJob {
 
     }
 
+
+    @XxlJob("jyLastHourOrderGet")
+    public void jyLastHourOrderGet() throws Exception {
+        log.info("-------------------------获取快分销订单当天当小时数据开始--------------------------");
+        List<JSONObject> cookies = jiaoYangFenXiaoService.getCookie();
+        if (Check.isNull(cookies)) {
+            log.error("cookie数据为空");
+            return;
+        }
+        String date = DateUtils.getNowDate("yyyy-MM-dd");
+        Integer nowHour = DateUtils.getNowHour();
+        JSONArray hours = new JSONArray();
+
+        if (nowHour >= 1) {
+            hours.add(nowHour - 1);
+        } else {
+            return;
+        }
+        JSONArray minSecList = KuaishouMinSecEnum.getMinSecList();
+        for (int i = 0; i < hours.size(); i++) {
+            Integer hour = hours.getInteger(i);
+            for (int j = 0; j < minSecList.size(); j++) {
+                JSONObject minSecJson = minSecList.getJSONObject(j);
+                String startTime = minSecJson.getString("startTime");
+                String endTime = minSecJson.getString("endTime");
+                String start = date + " " + hour + ":" + startTime;
+                String end = date + " " + hour + ":" + endTime;
+                System.err.println("开始时间:" + start);
+                System.err.println("结束时间:" + end);
+                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                Long orderCreateTimeStart = sdf.parse(start).getTime();
+                Long orderCreateTimeEnd = sdf.parse(end).getTime();
+                for (int p = 0; p < cookies.size(); p++) {
+                    JSONObject cookieJson = cookies.get(p);
+                    String cookie = cookieJson.getString("cookie");
+                    jiaoYangFenXiaoService.getOrderList(cookie, 0, orderCreateTimeStart, orderCreateTimeEnd);
+                }
+            }
+        }
+    }
+
+
     /**
      * 当前小时数据获取
      **/
@@ -133,11 +175,6 @@ public class JiaoYangFenXiaoJob {
         Integer nowHour = DateUtils.getNowHour();
         JSONArray hours = new JSONArray();
         hours.add(nowHour);
-        if (nowHour >= 1) {
-            hours.add(nowHour - 1);
-        }
-
-
         JSONArray minSecList = KuaishouMinSecEnum.getMinSecList();
         for (int i = 0; i < hours.size(); i++) {
             Integer hour = hours.getInteger(i);
@@ -162,7 +199,6 @@ public class JiaoYangFenXiaoJob {
     }
 
 
-
     /**
      * 当天前前小时数据获取
      **/
@@ -183,7 +219,7 @@ public class JiaoYangFenXiaoJob {
         Integer nowHour = DateUtils.getNowHour();
         for (int i = 0; i < hourList.size(); i++) {
             String hour = hourList.getString(i);
-            Integer integer = Integer.valueOf(hour.replace(":","").replace(" ",""));
+            Integer integer = Integer.valueOf(hour.replace(":", "").replace(" ", ""));
             if (integer <= nowHour) {
                 for (int j = 0; j < minSecList.size(); j++) {
                     JSONObject minSecJson = minSecList.getJSONObject(j);
@@ -376,7 +412,6 @@ public class JiaoYangFenXiaoJob {
     }
 
 
-
     // 前7 14 21 30 天数据获取
     @XxlJob("jyAppointYesterdayOrderGet")
     public void jyAppointYesterdayOrderGet() throws Exception {