Browse Source

炸弹睿选达人激励

yumeng 1 year ago
parent
commit
cb32c6f1f2

+ 103 - 16
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java

@@ -1,3 +1,4 @@
+
 package org.jeecg.modules.ctop.controller;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
@@ -137,7 +138,8 @@ public class TestController {
 
     @Autowired
     private IBatchService batchService;
-    static ExecutorService videoService = Executors.newFixedThreadPool(10);
+    static ExecutorService videoService = Executors.newFixedThreadPool(3);
+    static ExecutorService jy = Executors.newFixedThreadPool(2);
     @Autowired
     private IMaterialUploadService materialUploadService;
     @Autowired
@@ -145,7 +147,7 @@ public class TestController {
     @Autowired
     private IRefreshTokenService refreshTokenService;
     @Autowired
-    private IKuaishouSupplyChainService ikuaishouSupplyChainService;
+    private IMgsSupplyChainService ikuaishouSupplyChainService;
     @Autowired
     private IWechatCheckinDataService wechatCheckinDataService;
     @Autowired
@@ -158,33 +160,118 @@ public class TestController {
     @Autowired
     private IJiaoYangFenXiaoService jiaoYangFenXiaoService;
 
-    public static void main(String[] args) {
-        List<String> days = DateUtils.getDays("2023-08-01", "2023-09-25");
-        System.err.println(days);
-    }
+    @Autowired
+    private IKuaishouSupplyChainService kuaishouSupplyChainService;
 
 
+  /*  public static void main(String[] args) {
+        List<JSONObject> cookies = kuaishouSupplyChainService.getCookie();
+        if (Check.isNull(cookies)) {
+            return;
+        }
+
+        for (int i = 0; i < cookies.size(); i++) {
+            JSONObject jsonObject = cookies.get(i);
+            String cookie = jsonObject.getString("cookie");
+            kuaishouSupplyChainService.getRuiXuanCcrInfo(cookie, 100, "ruixuan");
+
+        }
+    }*/
+
 
     @GetMapping(value = "/getData")
     public void getDate(String startDate, String endDate) throws Exception {
 
-        String cookie = jiaoYangFenXiaoService.getCookieById(341063986L);
-        if (Check.isNull(cookie)) {
+        log.info("-------------------------获取快分销订单当前月数据开始数据开始--------------------------");
+        List<JSONObject> cookies = ikuaishouSupplyChainService.getCookie();
+        if (Check.isNull(cookies)) {
             log.error("cookie数据为空");
             return;
         }
-        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
-        Long statDate = Long.valueOf(nowDate.replace("-", ""));
-        List<JSONObject> accountList = jiaoYangFenXiaoService.getAccountList();
-        for (int i = 0; i < accountList.size(); i++) {
-            JSONObject jsonObject = accountList.get(i);
-            Long id = jsonObject.getLong("id");
-            String name = jsonObject.getString("name");
-            jiaoYangFenXiaoService.getItemTop(cookie,statDate, id, name, 0);
+
+        List<String> days = DateUtils.getDays("2024-02-25", "2024-03-05");
+        JSONArray hourList = KuaishouHourEnum.getHourList();
+        JSONArray minSecList = KuaishouMinSecEnum.getMinSecList();
+        Map<Long, Long> itemMap = activityItemListService.getItemMap();
+        for (int z = 0; z < days.size(); z++) {
+            String date = days.get(z);
+            for (int i = 0; i < hourList.size(); i++) {
+                String hour = hourList.getString(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;
+                    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");
+                        videoService.submit(new Runnable() {
+                            @Override
+                            public void run() {
+                                try {
+                                    ikuaishouSupplyChainService.getOrderList(cookie, 0, orderCreateTimeStart, orderCreateTimeEnd, itemMap);
+                                } catch (Exception e) {
+                                    e.printStackTrace();
+                                }
+                            }
+                        });
+                    }
+                }
+            }
         }
     }
 
 
+    @GetMapping(value = "/getJyData")
+    public void getJyData() throws Exception {
+
+        log.info("-------------------------获取快分销订单当前月数据开始数据开始--------------------------");
+        List<JSONObject> cookies = jiaoYangFenXiaoService.getCookie();
+        if (Check.isNull(cookies)) {
+            log.error("cookie数据为空");
+            return;
+        }
+
+        List<String> days = DateUtils.getDays("2023-12-01", "2024-02-28");
+        JSONArray hourList = KuaishouHourEnum.getHourList();
+        JSONArray minSecList = KuaishouMinSecEnum.getMinSecList();
+
+        for (int z = 0; z < days.size(); z++) {
+            String date = days.get(z);
+            for (int i = 0; i < hourList.size(); i++) {
+                String hour = hourList.getString(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;
+                    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");
+                        jy.submit(new Runnable() {
+                            @Override
+                            public void run() {
+                                try {
+                                    jiaoYangFenXiaoService.getOrderList(cookie, 0, orderCreateTimeStart, orderCreateTimeEnd);
+                                } catch (Exception e) {
+                                    e.printStackTrace();
+                                }
+                            }
+                        });
+                    }
+                }
+            }
+        }
+    }
+
     @GetMapping(value = "/getSettlementData")
     public void getsettlementData(String startDay, String endDay) throws Exception {
         List<String> days = DateUtils.getDays(startDay, endDay);

+ 17 - 4
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/settlementJob.java

@@ -84,7 +84,6 @@ public class settlementJob {
     }
 
 
-
     @XxlJob("mgsCleanSettlementData")
     public void mgsCleanSettlementData() {
         String url = "http://mgs.api.tjyourong.com.cn/settlement/data";
@@ -156,16 +155,30 @@ public class settlementJob {
         ikuaishouSupplyChainService.cleanBytedancePromoterBindChannel(date);
 
 
-
         ikuaishouSupplyChainService.deleteMgsPromoterBindChannelByDate(date);
         ikuaishouSupplyChainService.cleanMgsKuaiShouPromoterBindChannel(date);
 
 
+        ikuaishouSupplyChainService.deleteRocketPromoterBindChannelByDate(date);
+        ikuaishouSupplyChainService.cleanRocketKuaiShouPromoterBindChannel(date);
 
+    }
 
 
-        ikuaishouSupplyChainService.deleteRocketPromoterBindChannelByDate(date);
-        ikuaishouSupplyChainService.cleanRocketKuaiShouPromoterBindChannel(date);
+    @XxlJob("getCcrInfo")
+    public void getCcrInfo() throws InterruptedException {
+        List<JSONObject> cookies = ikuaishouSupplyChainService.getCookie();
+        if (Check.isNull(cookies)) {
+            return;
+        }
+
+        for (int i = 0; i < cookies.size(); i++) {
+            JSONObject jsonObject = cookies.get(i);
+            String cookie = jsonObject.getString("cookie");
+            ikuaishouSupplyChainService.getRuiXuanCcrInfo(cookie, 100, "ruixuan");
+
+        }
+
 
     }
 

+ 4 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouSupplyChainService.java

@@ -9,12 +9,13 @@ import java.util.Map;
 
 /**
  * 快手电商-供应链订单信息
+ *
  * @author jeecg-boot
  * 2022-12-01
  * @version V1.0
  */
 public interface IKuaishouSupplyChainService extends IService<KuaishouSupplyChain> {
-    void getOrderList(String cookie, Integer offset, Long orderCreateTimeStart, Long orderCreateTimeEnd, Map<Long,Long> itemMap) throws Exception;
+    void getOrderList(String cookie, Integer offset, Long orderCreateTimeStart, Long orderCreateTimeEnd, Map<Long, Long> itemMap) throws Exception;
 
     List<JSONObject> getCookie();
 
@@ -43,4 +44,6 @@ public interface IKuaishouSupplyChainService extends IService<KuaishouSupplyChai
     void cleanRocketKuaiShouPromoterBindChannel(Long date);
 
     List<JSONObject> getRocketDataList(Long statDate);
+
+    void getRuiXuanCcrInfo(String cookie, Integer offset, String type) throws InterruptedException;
 }

+ 27 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouSupplyChainServiceImpl.java

@@ -135,6 +135,31 @@ public class KuaishouSupplyChainServiceImpl extends ServiceImpl<KuaishouSupplyCh
 
     }
 
+
+    @Override
+    public void getRuiXuanCcrInfo(String cookie, Integer offset, String type) throws InterruptedException {
+        Thread.sleep(1000);
+        Map<String, Object> params = new HashMap<>();
+
+        params.put("filters", "{}");
+        params.put("sorter", "{}");
+        params.put("baseOrderStatus", 0);
+        params.put("limit", 100);
+        params.put("offset", offset);
+
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Cookie", cookie);
+
+        String resultStr = HttpUtils.httpPostFormRequest("https://cps.kwaixiaodian.com/gateway/distribute/platform/investment/activity/queryCrossActivityItem", params, headers);
+        JSONObject result = JSONObject.parseObject(resultStr);
+
+        System.err.println(resultStr);
+       /* if (list.size() >= 100) {
+            getOrderList(cookie, offset + 100, orderCreateTimeStart, orderCreateTimeEnd, itemMap);
+        }*/
+    }
+
+
     @Override
     public List<JSONObject> getCookie() {
         return supplyChainMapper.getCookie();
@@ -250,9 +275,10 @@ public class KuaishouSupplyChainServiceImpl extends ServiceImpl<KuaishouSupplyCh
         return supplyChainMapper.getRocketDataList(statDate);
     }
 
+
     @Override
     public void deleteRocketPromoterBindChannelByDate(Long date) {
-         supplyChainMapper.deleteRocketPromoterBindChannelByDate(date);
+        supplyChainMapper.deleteRocketPromoterBindChannelByDate(date);
     }
 
     @Override
@@ -261,7 +287,6 @@ public class KuaishouSupplyChainServiceImpl extends ServiceImpl<KuaishouSupplyCh
     }
 
 
-
     public static String filterSupplement(String content) {
         StringBuilder sb = new StringBuilder();
         for (char ch : content.toCharArray()) {