Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KFXAccessTokenJob.java
zhaoxian 10 mesi fa
parent
commit
8de510faf4
26 ha cambiato i file con 1121 aggiunte e 520 eliminazioni
  1. 8 6
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
  2. 3 3
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  3. 3 0
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KFXAccessTokenJob.java
  4. 0 10
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouOrderLIstGetJob.java
  5. 159 0
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/YufuOrderLIstGetJob.java
  6. 37 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/settlementJob.java
  7. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouActivityItemListMapper.java
  8. 8 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaishouSupplyChainMapper.java
  9. 8 7
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/MgsSupplyChainMapper.java
  10. 3 8
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/RocketSupplyChainMapper.java
  11. 33 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/YufuSupplyChainMapper.java
  12. 5 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouActivityItemListMapper.xml
  13. 57 15
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaishouSupplyChainMapper.xml
  14. 198 97
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/MgsSupplyChainMapper.xml
  15. 10 118
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/RocketSupplyChainMapper.xml
  16. 285 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/YufuSupplyChainMapper.xml
  17. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouActivityItemListService.java
  18. 9 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouSupplyChainService.java
  19. 2 15
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IMgsSupplyChainService.java
  20. 0 7
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/RocketSupplyChainService.java
  21. 19 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/YufuSupplyChainService.java
  22. 14 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouActivityItemListServiceImpl.java
  23. 30 58
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouSupplyChainServiceImpl.java
  24. 15 82
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/MgsSupplyChainServiceImpl.java
  25. 10 90
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/RocketSupplyChainServiceImpl.java
  26. 201 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/YufuSupplyChainServiceImpl.java

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

@@ -166,25 +166,29 @@ public class TestController {
 
     @Autowired
     private IMgsSupplyChainService mgsSupplyChainService;
+    @Autowired
+    private IKuaishouSupplyChainService ikuaishouSupplyChainService;
 
+    @Autowired
+    private YufuSupplyChainService yufuSupplyChainService;
 
 
     @GetMapping(value = "/getData")
     public void getDate() throws Exception {
 
         String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
-        String startDate = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -10);
+        String startDate = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -4);
         String endDate = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
         List<String> days = DateUtils.getDays(startDate, endDate);
 
-        List<JSONObject> cookies = mgsSupplyChainService.getCookie();
+        List<JSONObject> cookies = yufuSupplyChainService.getCookie();
         if (Check.isNull(cookies)) {
             log.error("cookie数据为空");
             return;
         }
         JSONArray hourList = KuaishouHourEnum.getHourList();
         JSONArray minSecList = KuaishouMinSecEnum.getMinSecList();
-        Map<Long, Long> itemMap = activityItemListService.getMgsItemList();
+        Map<Long, Long> itemMap = activityItemListService.getYufuItemList();
         for (int z = 0; z < days.size(); z++) {
             String date = days.get(z);
             for (int i = 0; i < hourList.size(); i++) {
@@ -201,9 +205,7 @@ public class TestController {
                     for (int p = 0; p < cookies.size(); p++) {
                         JSONObject cookieJson = cookies.get(p);
                         String cookie = cookieJson.getString("cookie");
-                        mgsSupplyChainService.getOrderList(cookie, 0, orderCreateTimeStart, orderCreateTimeEnd, itemMap);
-
-
+                        yufuSupplyChainService.getOrderList(cookie, 0, orderCreateTimeStart, orderCreateTimeEnd, itemMap);
 
                     }
                 }

+ 3 - 3
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -121,11 +121,11 @@ public class SampleTest {
         for (int i = 0; i < cookies.size(); i++) {
             JSONObject jsonObject = cookies.get(i);
             String cookie = jsonObject.getString("cookie");
-            ikuaishouSupplyChainService.getCcrInfo(cookie, 100, "ruixuan");
+            ikuaishouSupplyChainService.getCcrInfo(cookie, 0, "ruixuan");
 
         }
 
-        Thread.sleep(5 * 1000);
+       /* Thread.sleep(5 * 1000);
 
         List<JSONObject> mgsCookies = ikuaishouSupplyChainService.getMgsCookie();
         for (int i = 0; i < mgsCookies.size(); i++) {
@@ -142,7 +142,7 @@ public class SampleTest {
             String cookie = jsonObject.getString("cookie");
             ikuaishouSupplyChainService.getCcrInfo(cookie, 100, "rocket");
 
-        }
+        }*/
     }
 
     @Test

+ 3 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KFXAccessTokenJob.java

@@ -14,6 +14,9 @@ public class KFXAccessTokenJob {
         HttpUtils2.httpGet(mgsUrl, null, null);
         String rocketUrl = "http://rocket.api.tjyourong.com.cn/item/accessToken";
         HttpUtils2.httpGet(rocketUrl, null, null);
+        String yufuUrl = "http://yufu.api.tjyourong.com.cn/item/accessToken";
+        HttpUtils2.httpGet(yufuUrl, null, null);
+
         String jyUrl = "http://ruixuan.api.tjyourong.com.cn/item/jyAccessToken";
         HttpUtils2.httpGet(jyUrl, null, null);
     }

+ 0 - 10
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouOrderLIstGetJob.java

@@ -133,16 +133,6 @@ public class KuaishouOrderLIstGetJob {
                         JSONObject cookieJson = cookies.get(p);
                         String cookie = cookieJson.getString("cookie");
                         ikuaishouSupplyChainService.getOrderList(cookie, 0, orderCreateTimeStart, orderCreateTimeEnd, itemMap);
-                        fxService.submit(new Runnable() {
-                            @Override
-                            public void run() {
-                                try {
-                                    ikuaishouSupplyChainService.getOrderList(cookie, 0, orderCreateTimeStart, orderCreateTimeEnd, itemMap);
-                                } catch (Exception e) {
-                                    e.printStackTrace();
-                                }
-                            }
-                        });
 
 
                     }

+ 159 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/YufuOrderLIstGetJob.java

@@ -0,0 +1,159 @@
+package cn.com.ctop.job.kuaishou.handler;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.batch.Enums.KuaishouHourEnum;
+import cn.com.ctop.kuaishou.modules.batch.Enums.KuaishouMinSecEnum;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouActivityItemListService;
+import cn.com.ctop.kuaishou.modules.batch.service.YufuSupplyChainService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.text.SimpleDateFormat;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+@Slf4j
+@Component
+public class YufuOrderLIstGetJob {
+
+    @Autowired
+    private YufuSupplyChainService yufuSupplyChainService;
+
+    @Autowired
+    private IKuaiShouActivityItemListService yufuActivityItemListService;
+
+    static ExecutorService fxService = Executors.newFixedThreadPool(3);
+
+    /**
+     * 昨日快分销数据获取
+     **/
+    @XxlJob("yufuYesterdayOrderGet")
+    public void yufuYesterdayOrderGet() throws Exception {
+        List<JSONObject> cookies = yufuSupplyChainService.getCookie();
+        if (Check.isNull(cookies)) {
+            log.error("cookie数据为空");
+            return;
+        }
+        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+        String date = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
+        JSONArray hourList = KuaishouHourEnum.getHourList();
+        JSONArray minSecList = KuaishouMinSecEnum.getMinSecList();
+        Map<Long, Long> itemMap = yufuActivityItemListService.getYufuItemList();
+        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;
+                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");
+                    yufuSupplyChainService.getOrderList(cookie, 0, orderCreateTimeStart, orderCreateTimeEnd, itemMap);
+                }
+            }
+        }
+    }
+
+
+    /**
+     * 当前小时数据获取
+     **/
+    @XxlJob("yufuNowHourOrderGet")
+    public void yufuNowHourOrderGet() throws Exception {
+        List<JSONObject> cookies = yufuSupplyChainService.getCookie();
+        if (Check.isNull(cookies)) {
+            log.error("cookie数据为空");
+            return;
+        }
+        String date = DateUtils.getNowDate("yyyy-MM-dd");
+        Integer nowHour = DateUtils.getNowHour();
+        JSONArray hours = new JSONArray();
+        hours.add(nowHour);
+        if (nowHour >= 1) {
+            hours.add(nowHour - 1);
+        }
+
+
+        JSONArray minSecList = KuaishouMinSecEnum.getMinSecList();
+        Map<Long, Long> itemMap = yufuActivityItemListService.getYufuItemList();
+        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");
+                    yufuSupplyChainService.getOrderList(cookie, 0, orderCreateTimeStart, orderCreateTimeEnd, itemMap);
+                }
+            }
+        }
+    }
+
+    /**
+     * 当天所有数据获取
+     **/
+    /**
+     * 当天数据获取
+     **/
+    @XxlJob("yufuFrontHourOrderGet")
+    public void yufuFrontHourOrderGet() throws Exception {
+        List<JSONObject> cookies = yufuSupplyChainService.getCookie();
+        if (Check.isNull(cookies)) {
+            log.error("cookie数据为空");
+            return;
+        }
+        String date = DateUtils.getNowDate("yyyy-MM-dd");
+        JSONArray hourList = KuaishouHourEnum.getHourList();
+        JSONArray minSecList = KuaishouMinSecEnum.getMinSecList();
+        Map<Long, Long> itemMap = yufuActivityItemListService.getYufuItemList();
+        Integer nowHour = DateUtils.getNowHour();
+        for (int i = 0; i < hourList.size(); i++) {
+            String hour = hourList.getString(i);
+            Integer integer = Integer.valueOf(hour.replace(":", "").replace(" ", ""));
+            if (integer <= nowHour) {
+                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");
+                        yufuSupplyChainService.getOrderList(cookie, 0, orderCreateTimeStart, orderCreateTimeEnd, itemMap);
+                    }
+                }
+            }
+        }
+    }
+
+
+}

+ 37 - 2
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/settlementJob.java

@@ -125,8 +125,29 @@ public class settlementJob {
 
     }
 
+    @XxlJob("yufuCleanSettlementData")
+    public void yufuCleanSettlementData() {
+        String url = "http://yufu.api.tjyourong.com.cn/settlement/data";
+        String date = DateUtils.getLastDay(DateUtils.date2Str(), 1);
+        Long statDate = Long.valueOf(date.replace("-", ""));
+        List<JSONObject> list = ikuaishouSupplyChainService.getYufuDataList(statDate);
+        if (Check.isNull(list)) {
+            return;
+        }
+        List<List<JSONObject>> partition = Lists.partition(list, 1000);
+        for (int i = 0; i < partition.size(); i++) {
+            List<JSONObject> jsonObjects = partition.get(i);
+            Map<String, Object> param = new HashMap<>();
+            param.put("statDate", statDate);
+            param.put("data", jsonObjects);
+            HttpUtils.httpPostRequest(url, param, null);
+        }
 
-    @XxlJob("cleanPromoterSettlementData")
+    }
+
+
+
+    /*@XxlJob("cleanPromoterSettlementData")
     public void cleanPromoterSettlementData() {
         String url = "http://ruixuan.api.tjyourong.com.cn/settlement/promoterData";
         String date = DateUtils.getLastDay(DateUtils.date2Str(), 1);
@@ -144,7 +165,7 @@ public class settlementJob {
             HttpUtils.httpPostRequest(url, param, null);
         }
 
-    }
+    }*/
 
 
     @XxlJob("cleanPromoterBindChannel")
@@ -162,6 +183,10 @@ public class settlementJob {
         ikuaishouSupplyChainService.deleteRocketPromoterBindChannelByDate(date);
         ikuaishouSupplyChainService.cleanRocketKuaiShouPromoterBindChannel(date);
 
+
+        ikuaishouSupplyChainService.deleteYufuPromoterBindChannelByDate(date);
+        ikuaishouSupplyChainService.cleanYufuKuaiShouPromoterBindChannel(date);
+
     }
 
 
@@ -198,6 +223,16 @@ public class settlementJob {
 
         }
 
+        Thread.sleep(5 * 1000);
+        List<JSONObject> yufuCookies = ikuaishouSupplyChainService.getYuFuCiikie();
+        for (int i = 0; i < yufuCookies.size(); i++) {
+            JSONObject jsonObject = yufuCookies.get(i);
+            String cookie = jsonObject.getString("cookie");
+            ikuaishouSupplyChainService.getCcrInfo(cookie, 0, "rocket");
+
+        }
+
+
     }
 
 

+ 2 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouActivityItemListMapper.java

@@ -26,4 +26,6 @@ public interface KuaiShouActivityItemListMapper extends BaseMapper<KuaiShouActiv
     List<JSONObject> getRocketItemList();
 
     void updateItemStatusByItem(@Param("itemId") Long itemId, @Param("itemStatus") Integer itemStatus);
+
+    List<JSONObject> getYufuItemList();
 }

+ 8 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaishouSupplyChainMapper.java

@@ -21,7 +21,6 @@ public interface KuaishouSupplyChainMapper extends BaseMapper<KuaishouSupplyChai
 
     List<JSONObject>  getCookie();
 
-    void replaceSettlement(@Param(value = "adds") List<KuaishouSupplyChainSettlement> supplyChains);
 
     List<JSONObject> getDataList(@Param("statDate") Long statDate);
 
@@ -56,4 +55,12 @@ public interface KuaishouSupplyChainMapper extends BaseMapper<KuaishouSupplyChai
     List<JSONObject> getMgsCookie();
 
     List<JSONObject> getRocketCookie();
+
+    List<JSONObject> getYuFuCiikie();
+
+    List<JSONObject> getYufuDataList(@Param("statDate") Long statDate);
+
+    void deleteYufuPromoterBindChannelByDate(@Param("date") Long date);
+
+    void cleanYufuKuaiShouPromoterBindChannel(Long date);
 }

+ 8 - 7
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/MgsSupplyChainMapper.java

@@ -20,17 +20,18 @@ public interface MgsSupplyChainMapper extends BaseMapper<KuaishouSupplyChain> {
 
     List<JSONObject>  getCookie();
 
-    void replaceSettlement(@Param(value = "adds") List<KuaishouSupplyChainSettlement> supplyChains);
 
-    List<JSONObject> getDataList(@Param("statDate") Long statDate);
 
-    List<JSONObject> getPromoterDataList(@Param("statDate") Long statDate);
 
-    void deletePromoterBindChannelByDate(@Param("date") Long date);
 
-    void cleanKuaiShouPromoterBindChannel(@Param("date") Long date);
 
-    List<JSONObject> getSamplesData(@Param("startDate") String startDate);
 
-    void cleanBytedancePromoterBindChannel(@Param("date") Long date);
+
+    void replaceRuixuanSupplyChains(@Param("adds") List<KuaishouSupplyChain> ruixuanSupplyChains);
+
+    void replaceMgsSupplyChains(@Param("adds") List<KuaishouSupplyChain> mgsSupplyChains);
+
+    void replaceRocketSupplyChains(@Param("adds") List<KuaishouSupplyChain> rocketSupplyChains);
+
+    void replaceYufuSupplyChains(@Param("adds") List<KuaishouSupplyChain> yufuSupplyChains);
 }

+ 3 - 8
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/RocketSupplyChainMapper.java

@@ -17,23 +17,18 @@ public interface RocketSupplyChainMapper extends BaseMapper<KuaishouSupplyChain>
 
     List<JSONObject> getCookie();
 
-    void replaceSettlement(@Param(value = "adds") List<KuaishouSupplyChainSettlement> supplyChains);
 
-    List<JSONObject> getDataList(@Param("statDate") Long statDate);
 
-    List<JSONObject> getPromoterDataList(@Param("statDate") Long statDate);
 
-    void deletePromoterBindChannelByDate(@Param("date") Long date);
 
-    void cleanKuaiShouPromoterBindChannel(@Param("date") Long date);
 
-    List<JSONObject> getSamplesData(@Param("startDate") String startDate);
 
-    void cleanBytedancePromoterBindChannel(@Param("date") Long date);
 
     void replaceRuixuanSupplyChains(@Param(value = "adds") List<KuaishouSupplyChain> ruixuanSupplyChains);
 
     void replaceMgsSupplyChains(@Param(value = "adds") List<KuaishouSupplyChain> mgsSupplyChains);
 
-    void replaceRocketSupplyChains(@Param(value = "adds") List<KuaishouSupplyChain> mgsSupplyChains);
+    void replaceRocketSupplyChains(@Param(value = "adds") List<KuaishouSupplyChain> rocketSupplyChains);
+
+    void replaceYufuSupplyChains(@Param(value = "adds")  List<KuaishouSupplyChain> yufuSupplyChains);
 }

+ 33 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/YufuSupplyChainMapper.java

@@ -0,0 +1,33 @@
+package cn.com.ctop.kuaishou.modules.batch.mapper;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouSupplyChain;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouSupplyChainSettlement;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 快手电商-供应链订单信息
+ */
+public interface YufuSupplyChainMapper extends BaseMapper<KuaishouSupplyChain> {
+
+
+    List<JSONObject> getCookie();
+
+
+
+
+
+
+
+
+    void replaceRuixuanSupplyChains(@Param(value = "adds") List<KuaishouSupplyChain> ruixuanSupplyChains);
+
+    void replaceMgsSupplyChains(@Param(value = "adds") List<KuaishouSupplyChain> mgsSupplyChains);
+
+    void replaceRocketSupplyChains(@Param(value = "adds") List<KuaishouSupplyChain> rocketSupplyChains);
+
+    void replaceYufuSupplyChains(@Param(value = "adds") List<KuaishouSupplyChain> yufuSupplyChains);
+}

+ 5 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouActivityItemListMapper.xml

@@ -107,4 +107,9 @@
         from rocket.kuaishou_activity_open_item_list
 
     </select>
+    <select id="getYufuItemList" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT item_id AS 'itemId', item_commission_rate AS 'itemCommissionRate'
+        FROM yufu.kuaishou_activity_open_item_list
+
+    </select>
 </mapper>

+ 57 - 15
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaishouSupplyChainMapper.xml

@@ -68,22 +68,7 @@
 
         </foreach>
     </insert>
-    <insert id="replaceSettlement">
-        replace into ruixuan.kuaishou_supply_chain_settlement(
-        oid,
-        settlement_amount,
-        settlement_time
 
-        )
-        values
-        <foreach collection="adds" item="add" separator=",">
-            (
-            #{add.oid},
-            #{add.settlementAmount},
-            #{add.settlementTime}
-            )
-        </foreach>
-    </insert>
     <insert id="cleanKuaiShouPromoterBindChannel" parameterType="java.lang.Long">
         insert into ruixuan.promoter_bind_channel_date (promoter_id, promoter_name,promoter_url, user_id, user_name, stat_date,media_id)
         select t1.promoter_id, t1.promoter_nick_name, t1.promoter_url,t1.user_id, t1.user_name, #{date},media_id
@@ -177,6 +162,11 @@
     <delete id="deleteRocketPromoterBindChannelByDate" parameterType="java.lang.Long">
         delete from rocket.promoter_bind_channel_date where stat_date = #{date}
     </delete>
+    <delete id="deleteYufuPromoterBindChannelByDate" parameterType="java.lang.Long">
+        DELETE
+        FROM yufu.promoter_bind_channel_date
+        WHERE stat_date = #{date}
+    </delete>
     <select id="getCookie" resultType="com.alibaba.fastjson.JSONObject">
 
         select  id ,cookie  from ruixuan.kuaishou_supply_chain_cookie
@@ -332,5 +322,57 @@ group by t1.promoter_id;
         select id, cookie
         from rocket.kuaishou_supply_chain_cookie
     </select>
+    <select id="getYuFuCiikie" resultType="com.alibaba.fastjson.JSONObject">
+        select id, cookie
+        from yufu.kuaishou_supply_chain_cookie
+    </select>
+    <select id="getYufuDataList" resultType="com.alibaba.fastjson.JSONObject" parameterType="java.lang.Long">
+        select t.*, tt.rule_type
+        from (select *
+              from (select t1.relate_id                                 as 'relateId',
+                            (case
+                                 when t2.rule_id is not null
+                                     then t2.rule_id
+                                 else 1
+                                end
+                                )                                        as 'ruleId',
+                            group_concat(t1.item_id)                     as 'itemIds',
+                            t1.promoter_id                               as 'promoterId',
+                            t1.promoter_name                             as 'promoterName',
+                            t1.item_create_id                            as 'itemCreateId',
+                            t1.item_create_name                          as 'itemCreateName',
+                            t1.promoter_create_id                        as 'promoterCreateId',
+                            t1.promoter_create_name                      as 'promoterCreateName',
+                            ifnull(sum(t1.order_num), 0)                 as 'orderNum',
+                            ifnull(sum(t1.valid_order_num), 0)           as 'validOrderNum',
+                            ifnull(sum(t1.yesterday_order_num), 0)       as 'yesterdayOrderNum',
+                            ifnull(sum(t1.yesterday_valid_order_num), 0) as 'yesterdayValidOrderNum',
+                            t1.stat_date                                 as 'statDate',
+                            round(t2.item_price / 100, 2)                as 'itemPrice'
+                    from yufu.kuaishou_rule_order_data t1
+                             left join yufu.kuaishou_item_list t2 on t1.item_id = t2.item_id
+                    where t1.stat_date = #{statDate}
+                      and t1.relate_id is not null
+                    group by t1.relate_id, t1.promoter_id) t
+              where t.itemPrice >= 6
+              order by t.validOrderNum desc) t
+                 left join yufu.kuaishou_settlement_rules tt
+                           on t.ruleId = tt.id
+    </select>
+    <select id="cleanYufuKuaiShouPromoterBindChannel" parameterType="java.lang.Long">
+        INSERT INTO yufu.promoter_bind_channel_date (promoter_id, promoter_name, promoter_url, user_id, user_name,
+                                                     stat_date, media_id)
+        SELECT t1.promoter_id, t1.promoter_nick_name, t1.promoter_url, t1.user_id, t1.user_name, #{date}, media_id
+        FROM yufu.kuaishou_promoter t1
+                 LEFT JOIN yufu.sys_user_role t2
+                           ON t1.user_id = t2.user_id
+                 LEFT JOIN yufu.sys_role t3
+                           ON t2.role_id = t3.role_id
+        WHERE 1 = 1
+          AND t1.media_id = '1'
+          AND t3.role_key IN ('bdManager', 'bd')
+          AND date_format(t1.create_time, '%Y%m%d') &lt;= #{date}
+        GROUP BY t1.promoter_id
+    </select>
 
 </mapper>

+ 198 - 97
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/MgsSupplyChainMapper.xml

@@ -2,7 +2,75 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.kuaishou.modules.batch.mapper.MgsSupplyChainMapper">
 
-    <insert id="replace">
+    <insert id="replaceRuixuanSupplyChains">
+        replace into ruixuan.kuaishou_supply_chain(
+        id,
+        oid,
+        item_id,
+        item_title,
+        reserve_price,
+        image_url,
+        order_status,
+        order_create_time,
+        send_status,
+        settlement_biz_type,
+        settlement_biz_type_desc,
+        send_time,
+        recv_time,
+        seller_id,
+        promoter_id,
+        promoter_nick_name,
+        activity_id,
+        order_amount,
+        pay_amount,
+        regimental_promotion_rate,
+        share_rate,
+        base_amount,
+        service_amount,
+        regimental_promotion_amount,
+        total_regimental_settle_amount,
+        stat_date,
+        stat_hour,
+        item_commission_rate
+        )
+        values
+        <foreach collection="adds" item="add" separator=",">
+            (
+            #{add.id},
+            #{add.oid},
+            #{add.itemId},
+            #{add.itemTitle},
+            #{add.reservePrice},
+            #{add.imageUrl},
+            #{add.orderStatus},
+            #{add.orderCreateTime},
+            #{add.sendStatus},
+            #{add.settlementBizType},
+            #{add.settlementBizTypeDesc},
+            #{add.sendTime},
+            #{add.recvTime},
+            #{add.sellerId},
+            #{add.promoterId},
+            #{add.promoterNickName},
+            #{add.activityId},
+            #{add.orderAmount},
+            #{add.payAmount},
+            #{add.regimentalPromotionRate},
+            #{add.shareRate},
+            #{add.baseAmount},
+            #{add.serviceAmount},
+            #{add.regimentalPromotionAmount},
+            #{add.totalRegimentalSettleAmount},
+            #{add.statDate},
+            #{add.statHour},
+            #{add.itemCommissionRate}
+            )
+
+        </foreach>
+
+
+    </insert>
+    <insert id="replaceMgsSupplyChains">
         replace into miaogousi.kuaishou_supply_chain(
         id,
         oid,
@@ -68,120 +136,153 @@
 
         </foreach>
     </insert>
-    <insert id="replaceSettlement">
-        replace into miaogousi.kuaishou_supply_chain_settlement(
+    <insert id="replaceRocketSupplyChains">
+        replace into rocket.kuaishou_supply_chain(
+        id,
         oid,
-        settlement_amount,
-        settlement_time
+        item_id,
+        item_title,
+        reserve_price,
+        image_url,
+        order_status,
+        order_create_time,
+        send_status,
+        settlement_biz_type,
+        settlement_biz_type_desc,
+        send_time,
+        recv_time,
+        seller_id,
+        promoter_id,
+        promoter_nick_name,
+        activity_id,
+        order_amount,
+        pay_amount,
+        regimental_promotion_rate,
+        share_rate,
+        base_amount,
+        service_amount,
+        regimental_promotion_amount,
+        total_regimental_settle_amount,
+        stat_date,
+        stat_hour,
+        item_commission_rate
+        )
+        values
+        <foreach collection="adds" item="add" separator=",">
+            (
+            #{add.id},
+            #{add.oid},
+            #{add.itemId},
+            #{add.itemTitle},
+            #{add.reservePrice},
+            #{add.imageUrl},
+            #{add.orderStatus},
+            #{add.orderCreateTime},
+            #{add.sendStatus},
+            #{add.settlementBizType},
+            #{add.settlementBizTypeDesc},
+            #{add.sendTime},
+            #{add.recvTime},
+            #{add.sellerId},
+            #{add.promoterId},
+            #{add.promoterNickName},
+            #{add.activityId},
+            #{add.orderAmount},
+            #{add.payAmount},
+            #{add.regimentalPromotionRate},
+            #{add.shareRate},
+            #{add.baseAmount},
+            #{add.serviceAmount},
+            #{add.regimentalPromotionAmount},
+            #{add.totalRegimentalSettleAmount},
+            #{add.statDate},
+            #{add.statHour},
+            #{add.itemCommissionRate}
+            )
 
+        </foreach>
+
+    </insert>
+    <insert id="replaceYufuSupplyChains">
+        replace into yufu.kuaishou_supply_chain(
+        id,
+        oid,
+        item_id,
+        item_title,
+        reserve_price,
+        image_url,
+        order_status,
+        order_create_time,
+        send_status,
+        settlement_biz_type,
+        settlement_biz_type_desc,
+        send_time,
+        recv_time,
+        seller_id,
+        promoter_id,
+        promoter_nick_name,
+        activity_id,
+        order_amount,
+        pay_amount,
+        regimental_promotion_rate,
+        share_rate,
+        base_amount,
+        service_amount,
+        regimental_promotion_amount,
+        total_regimental_settle_amount,
+        stat_date,
+        stat_hour,
+        item_commission_rate
         )
         values
         <foreach collection="adds" item="add" separator=",">
             (
+            #{add.id},
             #{add.oid},
-            #{add.settlementAmount},
-            #{add.settlementTime}
+            #{add.itemId},
+            #{add.itemTitle},
+            #{add.reservePrice},
+            #{add.imageUrl},
+            #{add.orderStatus},
+            #{add.orderCreateTime},
+            #{add.sendStatus},
+            #{add.settlementBizType},
+            #{add.settlementBizTypeDesc},
+            #{add.sendTime},
+            #{add.recvTime},
+            #{add.sellerId},
+            #{add.promoterId},
+            #{add.promoterNickName},
+            #{add.activityId},
+            #{add.orderAmount},
+            #{add.payAmount},
+            #{add.regimentalPromotionRate},
+            #{add.shareRate},
+            #{add.baseAmount},
+            #{add.serviceAmount},
+            #{add.regimentalPromotionAmount},
+            #{add.totalRegimentalSettleAmount},
+            #{add.statDate},
+            #{add.statHour},
+            #{add.itemCommissionRate}
             )
         </foreach>
     </insert>
-    <insert id="cleanKuaiShouPromoterBindChannel" parameterType="java.lang.Long">
-        insert into miaogousi.promoter_bind_channel_date (promoter_id, promoter_name,promoter_url, user_id, user_name, stat_date,media_id)
-        select t1.promoter_id, t1.promoter_nick_name, t1.promoter_url,t1.user_id, t1.user_name, #{date},media_id
-        from miaogousi.kuaishou_promoter t1
-        left join miaogousi.sys_user_role t2
-        on t1.user_id = t2.user_id
-        left join miaogousi.sys_role t3
-        on t2.role_id = t3.role_id
-        where  1 = 1
-        and t1.media_id = '2'
-        and t3.role_key in ('bdManager', 'bd')
-        and date_format(t1.create_time, '%Y%m%d')  &lt; #{date}
-        group by t1.promoter_id
 
-    </insert>
-    <delete id="deletePromoterBindChannelByDate" parameterType="java.lang.Long">
-        delete from miaogousi.promoter_bind_channel_date where stat_date = #{date}
-    </delete>
+
+
+
+
+
+
     <select id="getCookie" resultType="com.alibaba.fastjson.JSONObject">
 
         select  id ,cookie  from miaogousi.kuaishou_supply_chain_cookie
 
     </select>
-    <select id="getDataList" resultType="com.alibaba.fastjson.JSONObject" parameterType="java.lang.Long">
-      select t.*, tt.rule_type
-      from (select *
-      from (select t1.relate_id                                 as 'relateId',
-                   (case
-                        when t2.rule_id is not null
-                            then t2.rule_id
-                        else 1
-                       end
-                       )                                        as 'ruleId',
-                   group_concat(t1.item_id)                     as 'itemIds',
-                   t1.promoter_id                               as 'promoterId',
-                   t1.promoter_name                             as 'promoterName',
-                   t1.item_create_id                            as 'itemCreateId',
-                   t1.item_create_name                          as 'itemCreateName',
-                   t1.promoter_create_id                        as 'promoterCreateId',
-                   t1.promoter_create_name                      as 'promoterCreateName',
-                   ifnull(sum(t1.order_num), 0)                 as 'orderNum',
-                   ifnull(sum(t1.valid_order_num), 0)           as 'validOrderNum',
-                   ifnull(sum(t1.yesterday_order_num), 0)       as 'yesterdayOrderNum',
-                   ifnull(sum(t1.yesterday_valid_order_num), 0) as 'yesterdayValidOrderNum',
-                   t1.stat_date                                 as 'statDate',
-                   round(t2.item_price / 100, 2)                as 'itemPrice'
-            from miaogousi.kuaishou_rule_order_data t1
-                     left join miaogousi.kuaishou_item_list t2 on t1.item_id = t2.item_id
-            where t1.stat_date = #{statDate}
-              and t1.relate_id is not null
-            group by t1.relate_id, t1.promoter_id) t
-      where t.itemPrice >= 6
-      order by t.validOrderNum desc) t
-         left join miaogousi.kuaishou_settlement_rules tt
-                   on t.ruleId = tt.id
-    </select>
-    <select id="getPromoterDataList" resultType="com.alibaba.fastjson.JSONObject" parameterType="java.lang.Long">
-select t1.rule_id                                   as 'ruleId',
-       t1.promoter_id                               as 'promoterId',
-       t2.promoter_name                             as 'promoterName',
-       ifnull(sum(t2.order_num), 0)                 as 'orderNum',
-       ifnull(sum(t2.valid_order_num), 0)           as 'validOrderNum',
-       ifnull(sum(t2.yesterday_order_num), 0)       as 'yesterdayOrderNum',
-       ifnull(sum(t2.yesterday_valid_order_num), 0) as 'yesterdayValidOrderNum',
-       t2.stat_date                                 as 'statDate',
-       3                                            as 'rule_type',
-       t3.item_price                                as 'itemPrice'
-
-from miaogousi.promoter_bind_rule t1
-         left join miaogousi.kuaishou_rule_order_data t2 on t1.promoter_id = t2.promoter_id
-         left join miaogousi.kuaishou_item_list t3 on t2.item_id = t3.item_id
-where 1 = 1
-  and t2.stat_date =  #{statDate}
-  and t3.item_price >= 600
-group by t1.promoter_id;
 
 
-    </select>
-    <select id="getSamplesData" resultType="com.alibaba.fastjson.JSONObject" parameterType="java.lang.String">
-      select  id,courier_number as 'courierNumber',company_code as 'companyCode' from miaogousi.kuaishou_item_collect_samples
-      where courier_number_time  &gt;=  str_to_date(CONCAT(date_format(#{startDate}, '%Y-%m-%d'), '00:00:01'), '%Y-%m-%d %H:%i:%s')
-      and collect_sample_status  = 4
-      and collect_sample_desc = '单号异常'
-    </select>
-    <select id="cleanBytedancePromoterBindChannel" parameterType="java.lang.Long">
-          insert into miaogousi.promoter_bind_channel_date (promoter_id, promoter_name,promoter_url, user_id, user_name, stat_date,media_id)
-        select t1.promoter_id, t1.promoter_nick_name, t1.promoter_url,t1.user_id, t1.user_name, #{date},media_id
-        from miaogousi.kuaishou_promoter t1
-        left join miaogousi.sys_user_role t2
-        on t1.user_id = t2.user_id
-        left join miaogousi.sys_role t3
-        on t2.role_id = t3.role_id
-        where  1 = 1
-        and t1.media_id = '1'
-        and t3.role_key in ('bdManager', 'bd')
-        and date_format(t1.create_time, '%Y%m%d')  &lt;= #{date}
-        group by t1.promoter_id
 
-    </select>
+
 
 </mapper>

+ 10 - 118
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/RocketSupplyChainMapper.xml

@@ -1,9 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.kuaishou.modules.batch.mapper.RocketSupplyChainMapper">
-
-    <insert id="replace">
-        replace into rocket.kuaishou_supply_chain(
+    <insert id="replaceRuixuanSupplyChains">
+        replace into ruixuan.kuaishou_supply_chain(
         id,
         oid,
         item_id,
@@ -67,40 +66,11 @@
             )
 
         </foreach>
-    </insert>
-    <insert id="replaceSettlement">
-        replace into rocket.kuaishou_supply_chain_settlement(
-        oid,
-        settlement_amount,
-        settlement_time
 
-        )
-        values
-        <foreach collection="adds" item="add" separator=",">
-            (
-            #{add.oid},
-            #{add.settlementAmount},
-            #{add.settlementTime}
-            )
-        </foreach>
-    </insert>
-    <insert id="cleanKuaiShouPromoterBindChannel" parameterType="java.lang.Long">
-        insert into rocket.promoter_bind_channel_date (promoter_id, promoter_name,promoter_url, user_id, user_name, stat_date,media_id)
-        select t1.promoter_id, t1.promoter_nick_name, t1.promoter_url,t1.user_id, t1.user_name, #{date},media_id
-        from rocket.kuaishou_promoter t1
-        left join rocket.sys_user_role t2
-        on t1.user_id = t2.user_id
-        left join rocket.sys_role t3
-        on t2.role_id = t3.role_id
-        where  1 = 1
-        and t1.media_id = '2'
-        and t3.role_key in ('bdManager', 'bd')
-        and date_format(t1.create_time, '%Y%m%d')  &lt; #{date}
-        group by t1.promoter_id
 
     </insert>
-    <insert id="replaceRuixuanSupplyChains">
-        replace into ruixuan.kuaishou_supply_chain(
+    <insert id="replaceMgsSupplyChains">
+        replace into miaogousi.kuaishou_supply_chain(
         id,
         oid,
         item_id,
@@ -164,11 +134,9 @@
             )
 
         </foreach>
-
-
     </insert>
-    <insert id="replaceMgsSupplyChains">
-        replace into miaogousi.kuaishou_supply_chain(
+    <insert id="replaceRocketSupplyChains">
+        replace into rocket.kuaishou_supply_chain(
         id,
         oid,
         item_id,
@@ -232,9 +200,10 @@
             )
 
         </foreach>
+
     </insert>
-    <insert id="replaceRocketSupplyChains">
-        replace into rocket.kuaishou_supply_chain(
+    <insert id="replaceYufuSupplyChains">
+        replace into yufu.kuaishou_supply_chain(
         id,
         oid,
         item_id,
@@ -296,93 +265,16 @@
             #{add.statHour},
             #{add.itemCommissionRate}
             )
-
         </foreach>
-
     </insert>
-    <delete id="deletePromoterBindChannelByDate" parameterType="java.lang.Long">
-        delete from rocket.promoter_bind_channel_date where stat_date = #{date}
-    </delete>
+
     <select id="getCookie" resultType="com.alibaba.fastjson.JSONObject">
 
         select  id ,cookie  from rocket.kuaishou_supply_chain_cookie
 
     </select>
-    <select id="getDataList" resultType="com.alibaba.fastjson.JSONObject" parameterType="java.lang.Long">
-      select t.*, tt.rule_type
-      from (select *
-      from (select t1.relate_id                                 as 'relateId',
-                   (case
-                        when t2.rule_id is not null
-                            then t2.rule_id
-                        else 1
-                       end
-                       )                                        as 'ruleId',
-                   group_concat(t1.item_id)                     as 'itemIds',
-                   t1.promoter_id                               as 'promoterId',
-                   t1.promoter_name                             as 'promoterName',
-                   t1.item_create_id                            as 'itemCreateId',
-                   t1.item_create_name                          as 'itemCreateName',
-                   t1.promoter_create_id                        as 'promoterCreateId',
-                   t1.promoter_create_name                      as 'promoterCreateName',
-                   ifnull(sum(t1.order_num), 0)                 as 'orderNum',
-                   ifnull(sum(t1.valid_order_num), 0)           as 'validOrderNum',
-                   ifnull(sum(t1.yesterday_order_num), 0)       as 'yesterdayOrderNum',
-                   ifnull(sum(t1.yesterday_valid_order_num), 0) as 'yesterdayValidOrderNum',
-                   t1.stat_date                                 as 'statDate',
-                   round(t2.item_price / 100, 2)                as 'itemPrice'
-            from rocket.kuaishou_rule_order_data t1
-                     left join rocket.kuaishou_item_list t2 on t1.item_id = t2.item_id
-            where t1.stat_date = #{statDate}
-              and t1.relate_id is not null
-            group by t1.relate_id, t1.promoter_id) t
-      where t.itemPrice >= 6
-      order by t.validOrderNum desc) t
-         left join rocket.kuaishou_settlement_rules tt
-                   on t.ruleId = tt.id
-    </select>
-    <select id="getPromoterDataList" resultType="com.alibaba.fastjson.JSONObject" parameterType="java.lang.Long">
-select t1.rule_id                                   as 'ruleId',
-       t1.promoter_id                               as 'promoterId',
-       t2.promoter_name                             as 'promoterName',
-       ifnull(sum(t2.order_num), 0)                 as 'orderNum',
-       ifnull(sum(t2.valid_order_num), 0)           as 'validOrderNum',
-       ifnull(sum(t2.yesterday_order_num), 0)       as 'yesterdayOrderNum',
-       ifnull(sum(t2.yesterday_valid_order_num), 0) as 'yesterdayValidOrderNum',
-       t2.stat_date                                 as 'statDate',
-       3                                            as 'rule_type',
-       t3.item_price                                as 'itemPrice'
 
-from rocket.promoter_bind_rule t1
-         left join rocket.kuaishou_rule_order_data t2 on t1.promoter_id = t2.promoter_id
-         left join rocket.kuaishou_item_list t3 on t2.item_id = t3.item_id
-where 1 = 1
-  and t2.stat_date =  #{statDate}
-  and t3.item_price >= 600
-group by t1.promoter_id;
 
 
-    </select>
-    <select id="getSamplesData" resultType="com.alibaba.fastjson.JSONObject" parameterType="java.lang.String">
-      select  id,courier_number as 'courierNumber',company_code as 'companyCode' from rocket.kuaishou_item_collect_samples
-      where courier_number_time  &gt;=  str_to_date(CONCAT(date_format(#{startDate}, '%Y-%m-%d'), '00:00:01'), '%Y-%m-%d %H:%i:%s')
-      and collect_sample_status  = 4
-      and collect_sample_desc = '单号异常'
-    </select>
-    <select id="cleanBytedancePromoterBindChannel" parameterType="java.lang.Long">
-          insert into rocket.promoter_bind_channel_date (promoter_id, promoter_name,promoter_url, user_id, user_name, stat_date,media_id)
-        select t1.promoter_id, t1.promoter_nick_name, t1.promoter_url,t1.user_id, t1.user_name, #{date},media_id
-        from rocket.kuaishou_promoter t1
-        left join rocket.sys_user_role t2
-        on t1.user_id = t2.user_id
-        left join rocket.sys_role t3
-        on t2.role_id = t3.role_id
-        where  1 = 1
-        and t1.media_id = '1'
-        and t3.role_key in ('bdManager', 'bd')
-        and date_format(t1.create_time, '%Y%m%d')  &lt;= #{date}
-        group by t1.promoter_id
-
-    </select>
 
 </mapper>

+ 285 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/YufuSupplyChainMapper.xml

@@ -0,0 +1,285 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.kuaishou.modules.batch.mapper.YufuSupplyChainMapper">
+
+
+
+
+    <insert id="replaceRuixuanSupplyChains">
+        replace into ruixuan.kuaishou_supply_chain(
+        id,
+        oid,
+        item_id,
+        item_title,
+        reserve_price,
+        image_url,
+        order_status,
+        order_create_time,
+        send_status,
+        settlement_biz_type,
+        settlement_biz_type_desc,
+        send_time,
+        recv_time,
+        seller_id,
+        promoter_id,
+        promoter_nick_name,
+        activity_id,
+        order_amount,
+        pay_amount,
+        regimental_promotion_rate,
+        share_rate,
+        base_amount,
+        service_amount,
+        regimental_promotion_amount,
+        total_regimental_settle_amount,
+        stat_date,
+        stat_hour,
+        item_commission_rate
+        )
+        values
+        <foreach collection="adds" item="add" separator=",">
+            (
+            #{add.id},
+            #{add.oid},
+            #{add.itemId},
+            #{add.itemTitle},
+            #{add.reservePrice},
+            #{add.imageUrl},
+            #{add.orderStatus},
+            #{add.orderCreateTime},
+            #{add.sendStatus},
+            #{add.settlementBizType},
+            #{add.settlementBizTypeDesc},
+            #{add.sendTime},
+            #{add.recvTime},
+            #{add.sellerId},
+            #{add.promoterId},
+            #{add.promoterNickName},
+            #{add.activityId},
+            #{add.orderAmount},
+            #{add.payAmount},
+            #{add.regimentalPromotionRate},
+            #{add.shareRate},
+            #{add.baseAmount},
+            #{add.serviceAmount},
+            #{add.regimentalPromotionAmount},
+            #{add.totalRegimentalSettleAmount},
+            #{add.statDate},
+            #{add.statHour},
+            #{add.itemCommissionRate}
+            )
+
+        </foreach>
+
+
+    </insert>
+    <insert id="replaceMgsSupplyChains">
+        replace into miaogousi.kuaishou_supply_chain(
+        id,
+        oid,
+        item_id,
+        item_title,
+        reserve_price,
+        image_url,
+        order_status,
+        order_create_time,
+        send_status,
+        settlement_biz_type,
+        settlement_biz_type_desc,
+        send_time,
+        recv_time,
+        seller_id,
+        promoter_id,
+        promoter_nick_name,
+        activity_id,
+        order_amount,
+        pay_amount,
+        regimental_promotion_rate,
+        share_rate,
+        base_amount,
+        service_amount,
+        regimental_promotion_amount,
+        total_regimental_settle_amount,
+        stat_date,
+        stat_hour,
+        item_commission_rate
+        )
+        values
+        <foreach collection="adds" item="add" separator=",">
+            (
+            #{add.id},
+            #{add.oid},
+            #{add.itemId},
+            #{add.itemTitle},
+            #{add.reservePrice},
+            #{add.imageUrl},
+            #{add.orderStatus},
+            #{add.orderCreateTime},
+            #{add.sendStatus},
+            #{add.settlementBizType},
+            #{add.settlementBizTypeDesc},
+            #{add.sendTime},
+            #{add.recvTime},
+            #{add.sellerId},
+            #{add.promoterId},
+            #{add.promoterNickName},
+            #{add.activityId},
+            #{add.orderAmount},
+            #{add.payAmount},
+            #{add.regimentalPromotionRate},
+            #{add.shareRate},
+            #{add.baseAmount},
+            #{add.serviceAmount},
+            #{add.regimentalPromotionAmount},
+            #{add.totalRegimentalSettleAmount},
+            #{add.statDate},
+            #{add.statHour},
+            #{add.itemCommissionRate}
+            )
+
+        </foreach>
+    </insert>
+    <insert id="replaceRocketSupplyChains">
+        replace into rocket.kuaishou_supply_chain(
+        id,
+        oid,
+        item_id,
+        item_title,
+        reserve_price,
+        image_url,
+        order_status,
+        order_create_time,
+        send_status,
+        settlement_biz_type,
+        settlement_biz_type_desc,
+        send_time,
+        recv_time,
+        seller_id,
+        promoter_id,
+        promoter_nick_name,
+        activity_id,
+        order_amount,
+        pay_amount,
+        regimental_promotion_rate,
+        share_rate,
+        base_amount,
+        service_amount,
+        regimental_promotion_amount,
+        total_regimental_settle_amount,
+        stat_date,
+        stat_hour,
+        item_commission_rate
+        )
+        values
+        <foreach collection="adds" item="add" separator=",">
+            (
+            #{add.id},
+            #{add.oid},
+            #{add.itemId},
+            #{add.itemTitle},
+            #{add.reservePrice},
+            #{add.imageUrl},
+            #{add.orderStatus},
+            #{add.orderCreateTime},
+            #{add.sendStatus},
+            #{add.settlementBizType},
+            #{add.settlementBizTypeDesc},
+            #{add.sendTime},
+            #{add.recvTime},
+            #{add.sellerId},
+            #{add.promoterId},
+            #{add.promoterNickName},
+            #{add.activityId},
+            #{add.orderAmount},
+            #{add.payAmount},
+            #{add.regimentalPromotionRate},
+            #{add.shareRate},
+            #{add.baseAmount},
+            #{add.serviceAmount},
+            #{add.regimentalPromotionAmount},
+            #{add.totalRegimentalSettleAmount},
+            #{add.statDate},
+            #{add.statHour},
+            #{add.itemCommissionRate}
+            )
+
+        </foreach>
+
+    </insert>
+    <insert id="replaceYufuSupplyChains">
+        replace into yufu.kuaishou_supply_chain(
+        id,
+        oid,
+        item_id,
+        item_title,
+        reserve_price,
+        image_url,
+        order_status,
+        order_create_time,
+        send_status,
+        settlement_biz_type,
+        settlement_biz_type_desc,
+        send_time,
+        recv_time,
+        seller_id,
+        promoter_id,
+        promoter_nick_name,
+        activity_id,
+        order_amount,
+        pay_amount,
+        regimental_promotion_rate,
+        share_rate,
+        base_amount,
+        service_amount,
+        regimental_promotion_amount,
+        total_regimental_settle_amount,
+        stat_date,
+        stat_hour,
+        item_commission_rate
+        )
+        values
+        <foreach collection="adds" item="add" separator=",">
+            (
+            #{add.id},
+            #{add.oid},
+            #{add.itemId},
+            #{add.itemTitle},
+            #{add.reservePrice},
+            #{add.imageUrl},
+            #{add.orderStatus},
+            #{add.orderCreateTime},
+            #{add.sendStatus},
+            #{add.settlementBizType},
+            #{add.settlementBizTypeDesc},
+            #{add.sendTime},
+            #{add.recvTime},
+            #{add.sellerId},
+            #{add.promoterId},
+            #{add.promoterNickName},
+            #{add.activityId},
+            #{add.orderAmount},
+            #{add.payAmount},
+            #{add.regimentalPromotionRate},
+            #{add.shareRate},
+            #{add.baseAmount},
+            #{add.serviceAmount},
+            #{add.regimentalPromotionAmount},
+            #{add.totalRegimentalSettleAmount},
+            #{add.statDate},
+            #{add.statHour},
+            #{add.itemCommissionRate}
+            )
+
+        </foreach>
+    </insert>
+
+    <select id="getCookie" resultType="com.alibaba.fastjson.JSONObject">
+
+        select  id ,cookie  from yufu.kuaishou_supply_chain_cookie
+
+    </select>
+
+
+
+
+</mapper>

+ 2 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouActivityItemListService.java

@@ -21,4 +21,6 @@ public interface IKuaiShouActivityItemListService extends IService<KuaiShouActiv
     Map<Long, Long> getMgsItemList();
 
     Map<Long, Long> getRocketItemList();
+
+    Map<Long, Long> getYufuItemList();
 }

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

@@ -19,7 +19,6 @@ public interface IKuaishouSupplyChainService extends IService<KuaishouSupplyChai
 
     List<JSONObject> getCookie();
 
-    void getSettlementData(String cookie, Integer offset, Long orderCreateTimeStart, Long orderCreateTimeEnd) throws Exception;
 
     List<JSONObject> getDataList(Long statDate);
 
@@ -50,4 +49,13 @@ public interface IKuaishouSupplyChainService extends IService<KuaishouSupplyChai
     List<JSONObject> getMgsCookie();
 
     List<JSONObject> getRocketCookie();
+
+    List<JSONObject> getYuFuCiikie();
+
+    List<JSONObject> getYufuDataList(Long statDate);
+
+    void deleteYufuPromoterBindChannelByDate(Long date);
+
+
+    void cleanYufuKuaiShouPromoterBindChannel(Long date);
 }

+ 2 - 15
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IMgsSupplyChainService.java

@@ -9,26 +9,13 @@ import java.util.Map;
 
 /**
  * 快手电商-供应链订单信息
+ *
  * @author jeecg-boot
  * 2022-12-01
  * @version V1.0
  */
 public interface IMgsSupplyChainService 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();
-
-    void getSettlementData(String cookie, Integer offset, Long orderCreateTimeStart, Long orderCreateTimeEnd) throws Exception;
-
-    List<JSONObject> getDataList(Long statDate);
-
-    List<JSONObject> getPromoterDataList(Long statDate);
-
-    void deletePromoterBindChannelByDate(Long date);
-
-    void cleanKuaiShouPromoterBindChannel(Long date);
-
-    List<JSONObject> getSamplesData(String startDate);
-
-    void cleanBytedancePromoterBindChannel(Long date);
 }

+ 0 - 7
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/RocketSupplyChainService.java

@@ -15,17 +15,10 @@ public interface RocketSupplyChainService extends IService<KuaishouSupplyChain>
 
     List<JSONObject> getCookie();
 
-    void getSettlementData(String cookie, Integer offset, Long orderCreateTimeStart, Long orderCreateTimeEnd) throws Exception;
 
-    List<JSONObject> getDataList(Long statDate);
 
-    List<JSONObject> getPromoterDataList(Long statDate);
 
-    void deletePromoterBindChannelByDate(Long date);
 
-    void cleanKuaiShouPromoterBindChannel(Long date);
 
-    List<JSONObject> getSamplesData(String startDate);
 
-    void cleanBytedancePromoterBindChannel(Long date);
 }

+ 19 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/YufuSupplyChainService.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.kuaishou.modules.batch.service;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouSupplyChain;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 快手电商-供应链订单信息
+ */
+public interface YufuSupplyChainService extends IService<KuaishouSupplyChain> {
+    void getOrderList(String cookie, Integer offset, Long orderCreateTimeStart, Long orderCreateTimeEnd, Map<Long,Long> itemMap) throws Exception;
+
+    List<JSONObject> getCookie();
+
+
+}

+ 14 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouActivityItemListServiceImpl.java

@@ -189,6 +189,20 @@ public class KuaiShouActivityItemListServiceImpl extends ServiceImpl<KuaiShouAct
         return returnMap;
     }
 
+    @Override
+    public Map<Long, Long> getYufuItemList() {
+        Map<Long, Long> returnMap = new HashMap<>();
+        List<JSONObject> list = activityItemListMapper.getYufuItemList();
+        if (!Check.isNull(list)) {
+            for (int i = 0; i < list.size(); i++) {
+                JSONObject jsonObject = list.get(i);
+                returnMap.put(jsonObject.getLong("itemId"), jsonObject.getLong("itemCommissionRate"));
+            }
+        }
+
+        return returnMap;
+    }
+
     public static String filterSupplement(String content) {
         StringBuilder sb = new StringBuilder();
         for (char ch : content.toCharArray()) {

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

@@ -99,6 +99,7 @@ public class KuaishouSupplyChainServiceImpl extends ServiceImpl<KuaishouSupplyCh
         List<KuaishouSupplyChain> ruixuanSupplyChains = new ArrayList<>();
         List<KuaishouSupplyChain> mgsSupplyChains = new ArrayList<>();
         List<KuaishouSupplyChain> rocketSupplyChains = new ArrayList<>();
+        List<KuaishouSupplyChain> yufuSupplyChains = new ArrayList<>();
         for (int i = 0; i < list.size(); i++) {
             JSONObject jsonObject = list.getJSONObject(i);
             KuaishouSupplyChain supplyChain = new KuaishouSupplyChain();
@@ -153,6 +154,9 @@ public class KuaishouSupplyChainServiceImpl extends ServiceImpl<KuaishouSupplyCh
                 if ("rocket".equals(ownership)) {
                     rocketSupplyChains.add(supplyChain);
                 }
+                if ("yufu".equals(ownership)) {
+                    yufuSupplyChains.add(supplyChain);
+                }
             }
 
         }
@@ -166,8 +170,13 @@ public class KuaishouSupplyChainServiceImpl extends ServiceImpl<KuaishouSupplyCh
             }
 
             if (!Check.isNull(rocketSupplyChains)) {
-                rocketSupplyChainMapper.replaceRocketSupplyChains(mgsSupplyChains);
+                rocketSupplyChainMapper.replaceRocketSupplyChains(rocketSupplyChains);
+            }
+
+            if (!Check.isNull(yufuSupplyChains)) {
+                rocketSupplyChainMapper.replaceYufuSupplyChains(yufuSupplyChains);
             }
+
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -186,7 +195,7 @@ public class KuaishouSupplyChainServiceImpl extends ServiceImpl<KuaishouSupplyCh
         params.put("filters", "{}");
         params.put("sorter", "{}");
         params.put("baseOrderStatus", 0);
-        params.put("limit", 100);
+        params.put("limit", 20);
         params.put("offset", offset);
         Map<String, String> headers = new HashMap<>();
         headers.put("Cookie", cookie);
@@ -235,8 +244,8 @@ public class KuaishouSupplyChainServiceImpl extends ServiceImpl<KuaishouSupplyCh
                     supplyChainMapper.replaceRocketCcr(adds);
                 }
 
-                if (adds.size() >= 100) {
-                    getCcrInfo(cookie, offset + 100, type);
+                if (adds.size() >= 20) {
+                    getCcrInfo(cookie, offset + 20, type);
                 }
             }
         } else {
@@ -257,70 +266,33 @@ public class KuaishouSupplyChainServiceImpl extends ServiceImpl<KuaishouSupplyCh
         return supplyChainMapper.getRocketCookie();
     }
 
+    @Override
+    public List<JSONObject> getYuFuCiikie() {
+        return supplyChainMapper.getYuFuCiikie();
+    }
 
     @Override
-    public List<JSONObject> getCookie() {
-        return supplyChainMapper.getCookie();
+    public List<JSONObject> getYufuDataList(Long statDate) {
+        return supplyChainMapper.getYufuDataList(statDate);
     }
 
     @Override
-    public void getSettlementData(String cookie, Integer offset, Long orderCreateTimeStart, Long orderCreateTimeEnd) throws Exception {
+    public void deleteYufuPromoterBindChannelByDate(Long date) {
+        supplyChainMapper.deleteYufuPromoterBindChannelByDate(date);
+    }
 
-        String getUrl = "https://cps.kwaixiaodian.com/distribute/pc/investment/bill/list";
-        Map<String, Object> params = new HashMap<>();
-        if (!Check.isNull(orderCreateTimeStart)) {
-            params.put("settlementTimeStart", orderCreateTimeStart);
-        }
-        if (!Check.isNull(orderCreateTimeEnd)) {
-            params.put("settlementTimeEnd", orderCreateTimeEnd);
-        }
+    @Override
+    public void cleanYufuKuaiShouPromoterBindChannel(Long date) {
+        supplyChainMapper.cleanYufuKuaiShouPromoterBindChannel(date);
+    }
 
-        params.put("limit", 5000);
-        params.put("offset", offset);
-        params.put("activityUserType", 1);
 
-        Map<String, String> headers = new HashMap<>();
-        headers.put("Cookie", cookie);
+    @Override
+    public List<JSONObject> getCookie() {
+        return supplyChainMapper.getCookie();
+    }
 
-        String resultStr = HttpUtils.KuaiShouttpGetRequest(getUrl, params, headers);
-        JSONObject result = JSONObject.parseObject(resultStr);
-        if (Check.isNull(result)) {
-            log.error("快分销数据返回为空");
-            return;
-        }
-        Integer code = result.getInteger("result");
-        if (code != 1) {
-            log.info("快分销数据返回异常:", resultStr);
-            sendMessageService.sendMessage("113dee46c7df464da78c07a985e92cd1", "快手供应链cookie失效,请及时更新。媒体返回信息:" + resultStr);
-            return;
-        }
-        JSONObject dataJson = result.getJSONObject("data");
-        if (Check.isNull(dataJson)) {
-            log.error("快分销数据返回为data数据为空");
-            return;
-        }
-        JSONArray list = dataJson.getJSONArray("list");
-        if (Check.isNull(list)) {
-            log.error("快分销数据返回为list数据为空");
-            return;
-        }
-        log.info("快分销当前数据条数:{}", list.size());
-        List<KuaishouSupplyChainSettlement> supplyChains = new ArrayList<>();
-        for (int i = 0; i < list.size(); i++) {
-            JSONObject jsonObject = list.getJSONObject(i);
-            KuaishouSupplyChainSettlement supplyChain = new KuaishouSupplyChainSettlement();
-            supplyChain.setOid(jsonObject.getLong("oid"));
-            supplyChain.setSettlementAmount(jsonObject.getLong("settlementAmount"));
-            supplyChain.setSettlementTime(jsonObject.getLong("settlementTime"));
 
-            supplyChains.add(supplyChain);
-        }
-        supplyChainMapper.replaceSettlement(supplyChains);
-        Thread.sleep(2000L);
-        if (list.size() >= 5000) {
-            getSettlementData(cookie, offset + 5000, orderCreateTimeStart, orderCreateTimeEnd);
-        }
-    }
 
     @Override
     public List<JSONObject> getDataList(Long statDate) {

+ 15 - 82
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/MgsSupplyChainServiceImpl.java

@@ -46,8 +46,7 @@ public class MgsSupplyChainServiceImpl extends ServiceImpl<KuaishouSupplyChainMa
     private MgsSupplyChainMapper mgsSupplyChainMapper;
     @Autowired
     private MongoTemplate mongoTemplate;
-    @Autowired
-    private RocketSupplyChainMapper rocketSupplyChainMapper;
+
 
     public static void main(String[] args) {
         System.err.println(DateUtils.tempToLongDateStr(1706112000000L));
@@ -100,6 +99,7 @@ public class MgsSupplyChainServiceImpl extends ServiceImpl<KuaishouSupplyChainMa
         List<KuaishouSupplyChain> ruixuanSupplyChains = new ArrayList<>();
         List<KuaishouSupplyChain> mgsSupplyChains = new ArrayList<>();
         List<KuaishouSupplyChain> rocketSupplyChains = new ArrayList<>();
+        List<KuaishouSupplyChain> yufuSupplyChains = new ArrayList<>();
         for (int i = 0; i < list.size(); i++) {
             JSONObject jsonObject = list.getJSONObject(i);
             KuaishouSupplyChain supplyChain = new KuaishouSupplyChain();
@@ -154,21 +154,30 @@ public class MgsSupplyChainServiceImpl extends ServiceImpl<KuaishouSupplyChainMa
                 if ("rocket".equals(ownership)) {
                     rocketSupplyChains.add(supplyChain);
                 }
+                if ("yufu".equals(ownership)) {
+                    yufuSupplyChains.add(supplyChain);
+                }
+
             }
         }
         try {
             if (!Check.isNull(ruixuanSupplyChains)) {
-                rocketSupplyChainMapper.replaceRuixuanSupplyChains(ruixuanSupplyChains);
+                mgsSupplyChainMapper.replaceRuixuanSupplyChains(ruixuanSupplyChains);
             }
 
             if (!Check.isNull(mgsSupplyChains)) {
-                rocketSupplyChainMapper.replaceMgsSupplyChains(mgsSupplyChains);
+                mgsSupplyChainMapper.replaceMgsSupplyChains(mgsSupplyChains);
             }
 
             if (!Check.isNull(rocketSupplyChains)) {
-                rocketSupplyChainMapper.replaceRocketSupplyChains(mgsSupplyChains);
+                mgsSupplyChainMapper.replaceRocketSupplyChains(rocketSupplyChains);
             }
 
+            if (!Check.isNull(yufuSupplyChains)) {
+                mgsSupplyChainMapper.replaceYufuSupplyChains(yufuSupplyChains);
+            }
+
+
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -184,94 +193,18 @@ public class MgsSupplyChainServiceImpl extends ServiceImpl<KuaishouSupplyChainMa
         return mgsSupplyChainMapper.getCookie();
     }
 
-    @Override
-    public void getSettlementData(String cookie, Integer offset, Long orderCreateTimeStart, Long orderCreateTimeEnd) throws Exception {
 
-        String getUrl = "https://cps.kwaixiaodian.com/distribute/pc/investment/bill/list";
-        Map<String, Object> params = new HashMap<>();
-        if (!Check.isNull(orderCreateTimeStart)) {
-            params.put("settlementTimeStart", orderCreateTimeStart);
-        }
-        if (!Check.isNull(orderCreateTimeEnd)) {
-            params.put("settlementTimeEnd", orderCreateTimeEnd);
-        }
 
-        params.put("limit", 5000);
-        params.put("offset", offset);
-        params.put("activityUserType", 1);
 
-        Map<String, String> headers = new HashMap<>();
-        headers.put("Cookie", cookie);
 
-        String resultStr = HttpUtils.KuaiShouttpGetRequest(getUrl, params, headers);
-        JSONObject result = JSONObject.parseObject(resultStr);
-        if (Check.isNull(result)) {
-            log.error("mgs数据返回为空");
-            return;
-        }
-        Integer code = result.getInteger("result");
-        if (code != 1) {
-            log.info("mgs返回异常:", resultStr);
-            sendMessageService.sendMessage("113dee46c7df464da78c07a985e92cd1", "mgs供应链cookie失效,请及时更新。媒体返回信息:" + resultStr);
-            return;
-        }
-        JSONObject dataJson = result.getJSONObject("data");
-        if (Check.isNull(dataJson)) {
-            log.error("快分销数据返回为data数据为空");
-            return;
-        }
-        JSONArray list = dataJson.getJSONArray("list");
-        if (Check.isNull(list)) {
-            log.error("快分销数据返回为list数据为空");
-            return;
-        }
-        log.info("快分销当前数据条数:{}", list.size());
-        List<KuaishouSupplyChainSettlement> supplyChains = new ArrayList<>();
-        for (int i = 0; i < list.size(); i++) {
-            JSONObject jsonObject = list.getJSONObject(i);
-            KuaishouSupplyChainSettlement supplyChain = new KuaishouSupplyChainSettlement();
-            supplyChain.setOid(jsonObject.getLong("oid"));
-            supplyChain.setSettlementAmount(jsonObject.getLong("settlementAmount"));
-            supplyChain.setSettlementTime(jsonObject.getLong("settlementTime"));
 
-            supplyChains.add(supplyChain);
-        }
-        mgsSupplyChainMapper.replaceSettlement(supplyChains);
-        Thread.sleep(2000L);
-        if (list.size() >= 5000) {
-            getSettlementData(cookie, offset + 5000, orderCreateTimeStart, orderCreateTimeEnd);
-        }
-    }
 
-    @Override
-    public List<JSONObject> getDataList(Long statDate) {
-        return mgsSupplyChainMapper.getDataList(statDate);
-    }
 
-    @Override
-    public List<JSONObject> getPromoterDataList(Long statDate) {
-        return mgsSupplyChainMapper.getPromoterDataList(statDate);
-    }
 
-    @Override
-    public void deletePromoterBindChannelByDate(Long date) {
-        mgsSupplyChainMapper.deletePromoterBindChannelByDate(date);
-    }
 
-    @Override
-    public void cleanKuaiShouPromoterBindChannel(Long date) {
-        mgsSupplyChainMapper.cleanKuaiShouPromoterBindChannel(date);
-    }
 
-    @Override
-    public List<JSONObject> getSamplesData(String startDate) {
-        return mgsSupplyChainMapper.getSamplesData(startDate);
-    }
 
-    @Override
-    public void cleanBytedancePromoterBindChannel(Long date) {
-        mgsSupplyChainMapper.cleanBytedancePromoterBindChannel(date);
-    }
+
 
     public static String filterSupplement(String content) {
         StringBuilder sb = new StringBuilder();

+ 10 - 90
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/RocketSupplyChainServiceImpl.java

@@ -96,6 +96,7 @@ public class RocketSupplyChainServiceImpl extends ServiceImpl<KuaishouSupplyChai
         List<KuaishouSupplyChain> ruixuanSupplyChains = new ArrayList<>();
         List<KuaishouSupplyChain> mgsSupplyChains = new ArrayList<>();
         List<KuaishouSupplyChain> rocketSupplyChains = new ArrayList<>();
+        List<KuaishouSupplyChain> yufuSupplyChains = new ArrayList<>();
         for (int i = 0; i < list.size(); i++) {
             JSONObject jsonObject = list.getJSONObject(i);
             KuaishouSupplyChain supplyChain = new KuaishouSupplyChain();
@@ -149,6 +150,10 @@ public class RocketSupplyChainServiceImpl extends ServiceImpl<KuaishouSupplyChai
                 if ("rocket".equals(ownership)) {
                     rocketSupplyChains.add(supplyChain);
                 }
+                if ("yufu".equals(ownership)) {
+                    yufuSupplyChains.add(supplyChain);
+                }
+
             }
 
         }
@@ -162,7 +167,11 @@ public class RocketSupplyChainServiceImpl extends ServiceImpl<KuaishouSupplyChai
             }
 
             if (!Check.isNull(rocketSupplyChains)) {
-                rocketSupplyChainMapper.replaceRocketSupplyChains(mgsSupplyChains);
+                rocketSupplyChainMapper.replaceRocketSupplyChains(rocketSupplyChains);
+            }
+
+            if (!Check.isNull(yufuSupplyChains)) {
+                rocketSupplyChainMapper.replaceYufuSupplyChains(yufuSupplyChains);
             }
 
 
@@ -181,95 +190,6 @@ public class RocketSupplyChainServiceImpl extends ServiceImpl<KuaishouSupplyChai
         return rocketSupplyChainMapper.getCookie();
     }
 
-    @Override
-    public void getSettlementData(String cookie, Integer offset, Long orderCreateTimeStart, Long orderCreateTimeEnd) throws Exception {
-
-        String getUrl = "https://cps.kwaixiaodian.com/distribute/pc/investment/bill/list";
-        Map<String, Object> params = new HashMap<>();
-        if (!Check.isNull(orderCreateTimeStart)) {
-            params.put("settlementTimeStart", orderCreateTimeStart);
-        }
-        if (!Check.isNull(orderCreateTimeEnd)) {
-            params.put("settlementTimeEnd", orderCreateTimeEnd);
-        }
-
-        params.put("limit", 5000);
-        params.put("offset", offset);
-        params.put("activityUserType", 1);
-
-        Map<String, String> headers = new HashMap<>();
-        headers.put("Cookie", cookie);
-
-        String resultStr = HttpUtils.KuaiShouttpGetRequest(getUrl, params, headers);
-        JSONObject result = JSONObject.parseObject(resultStr);
-        if (Check.isNull(result)) {
-            log.error("rocket数据返回为空");
-            return;
-        }
-        Integer code = result.getInteger("result");
-        if (code != 1) {
-            log.info("rocket返回异常:", resultStr);
-            sendMessageService.sendMessage("113dee46c7df464da78c07a985e92cd1", "rocket供应链cookie失效,请及时更新。媒体返回信息:" + resultStr);
-            return;
-        }
-        JSONObject dataJson = result.getJSONObject("data");
-        if (Check.isNull(dataJson)) {
-            log.error("快分销数据返回为data数据为空");
-            return;
-        }
-        JSONArray list = dataJson.getJSONArray("list");
-        if (Check.isNull(list)) {
-            log.error("快分销数据返回为list数据为空");
-            return;
-        }
-        log.info("快分销当前数据条数:{}", list.size());
-        List<KuaishouSupplyChainSettlement> supplyChains = new ArrayList<>();
-        for (int i = 0; i < list.size(); i++) {
-            JSONObject jsonObject = list.getJSONObject(i);
-            KuaishouSupplyChainSettlement supplyChain = new KuaishouSupplyChainSettlement();
-            supplyChain.setOid(jsonObject.getLong("oid"));
-            supplyChain.setSettlementAmount(jsonObject.getLong("settlementAmount"));
-            supplyChain.setSettlementTime(jsonObject.getLong("settlementTime"));
-
-            supplyChains.add(supplyChain);
-        }
-        rocketSupplyChainMapper.replaceSettlement(supplyChains);
-        Thread.sleep(2000L);
-        if (list.size() >= 5000) {
-            getSettlementData(cookie, offset + 5000, orderCreateTimeStart, orderCreateTimeEnd);
-        }
-    }
-
-    @Override
-    public List<JSONObject> getDataList(Long statDate) {
-        return rocketSupplyChainMapper.getDataList(statDate);
-    }
-
-    @Override
-    public List<JSONObject> getPromoterDataList(Long statDate) {
-        return rocketSupplyChainMapper.getPromoterDataList(statDate);
-    }
-
-    @Override
-    public void deletePromoterBindChannelByDate(Long date) {
-        rocketSupplyChainMapper.deletePromoterBindChannelByDate(date);
-    }
-
-    @Override
-    public void cleanKuaiShouPromoterBindChannel(Long date) {
-        rocketSupplyChainMapper.cleanKuaiShouPromoterBindChannel(date);
-    }
-
-    @Override
-    public List<JSONObject> getSamplesData(String startDate) {
-        return rocketSupplyChainMapper.getSamplesData(startDate);
-    }
-
-    @Override
-    public void cleanBytedancePromoterBindChannel(Long date) {
-        rocketSupplyChainMapper.cleanBytedancePromoterBindChannel(date);
-    }
-
     public static String filterSupplement(String content) {
         StringBuilder sb = new StringBuilder();
         for (char ch : content.toCharArray()) {

+ 201 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/YufuSupplyChainServiceImpl.java

@@ -0,0 +1,201 @@
+package cn.com.ctop.kuaishou.modules.batch.service.impl;
+
+
+import cn.com.ctop.common.module.service.ISendMessageService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouSupplyChain;
+import cn.com.ctop.kuaishou.modules.batch.entity.vo.ItemCheck;
+import cn.com.ctop.kuaishou.modules.batch.mapper.YufuSupplyChainMapper;
+import cn.com.ctop.kuaishou.modules.batch.service.YufuSupplyChainService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.mongodb.core.MongoTemplate;
+import org.springframework.data.mongodb.core.query.Criteria;
+import org.springframework.data.mongodb.core.query.Query;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 快手电商-供应链订单信息
+ *
+ * @author jeecg-boot
+ * 2022-12-01
+ * @version V1.0
+ */
+@Slf4j
+@Service
+public class YufuSupplyChainServiceImpl extends ServiceImpl<YufuSupplyChainMapper, KuaishouSupplyChain> implements YufuSupplyChainService {
+    private static String url = "https://cps.kwaixiaodian.com/distribute/pc/investment/order/list";
+    @Autowired
+    private ISendMessageService sendMessageService;
+    @Autowired
+    private YufuSupplyChainMapper yufuSupplyChainMapper;
+    @Autowired
+    private MongoTemplate mongoTemplate;
+
+    public static void main(String[] args) {
+        System.err.println(DateUtils.tempToLongDateStr(1706112000000L));
+    }
+
+
+    @Transactional
+    @Override
+    public void getOrderList(String cookie, Integer offset, Long orderCreateTimeStart, Long orderCreateTimeEnd, Map<Long, Long> itemMap) throws Exception {
+        Thread.sleep(1000);
+        log.info("yufu团长抓取订单数据入参,开始时间:{},结束时间:{},数据:{}", DateUtils.tempToLongDateStr(orderCreateTimeStart), DateUtils.tempToLongDateStr(orderCreateTimeEnd), offset);
+        Map<String, Object> params = new HashMap<>();
+        if (!Check.isNull(orderCreateTimeStart)) {
+            params.put("orderCreateTimeStart", orderCreateTimeStart);
+        }
+        if (!Check.isNull(orderCreateTimeEnd)) {
+            params.put("orderCreateTimeEnd", orderCreateTimeEnd);
+        }
+        params.put("fundType", 1);
+        params.put("timeType", 1);
+        params.put("limit", 100);
+        params.put("offset", offset);
+
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Cookie", cookie);
+
+        String resultStr = HttpUtils.KuaiShouttpGetRequest(url, params, headers);
+        JSONObject result = JSONObject.parseObject(resultStr);
+        if (Check.isNull(result)) {
+            log.error("快分销数据返回为空");
+            return;
+        }
+        Integer code = result.getInteger("result");
+        if (code != 1) {
+            log.info("yufu快分销数据返回异常:", resultStr);
+            sendMessageService.sendMessage("113dee46c7df464da78c07a985e92cd1", "yufucookie失效,请及时更新。媒体返回信息:" + resultStr);
+            return;
+        }
+        JSONObject dataJson = result.getJSONObject("data");
+        if (Check.isNull(dataJson)) {
+            log.error("yufu数据返回为data数据为空");
+            return;
+        }
+        JSONArray list = dataJson.getJSONArray("list");
+        if (Check.isNull(list)) {
+            log.error("yufu数据返回为list数据为空");
+            return;
+        }
+        log.info("yufu当前数据条数:{}", list.size());
+        List<KuaishouSupplyChain> ruixuanSupplyChains = new ArrayList<>();
+        List<KuaishouSupplyChain> mgsSupplyChains = new ArrayList<>();
+        List<KuaishouSupplyChain> rocketSupplyChains = new ArrayList<>();
+        List<KuaishouSupplyChain> yufuSupplyChains = new ArrayList<>();
+        for (int i = 0; i < list.size(); i++) {
+            JSONObject jsonObject = list.getJSONObject(i);
+            KuaishouSupplyChain supplyChain = new KuaishouSupplyChain();
+            supplyChain.setOid(jsonObject.getLong("oid"));
+            JSONObject item = jsonObject.getJSONArray("itemList").getJSONObject(0);
+            Long itemId = null;
+            if (!Check.isNull(item)) {
+                itemId = item.getLong("itemId");
+                supplyChain.setItemId(itemId);
+                supplyChain.setItemTitle(item.getString("itemTitle"));
+                supplyChain.setReservePrice(item.getLong("reservePrice"));
+                supplyChain.setImageUrl(item.getString("imageUrl"));
+            }
+            supplyChain.setOrderStatus(jsonObject.getInteger("orderStatus"));
+            supplyChain.setOrderCreateTime(jsonObject.getLong("orderCreateTime"));
+            supplyChain.setSendStatus(jsonObject.getInteger("sendStatus"));
+            supplyChain.setSettlementBizType(jsonObject.getInteger("settlementBizType"));
+            supplyChain.setSettlementBizTypeDesc(jsonObject.getString("settlementBizTypeDesc"));
+            supplyChain.setSendTime(jsonObject.getLong("sendTime"));
+            supplyChain.setRecvTime(jsonObject.getLong("recvTime"));
+            supplyChain.setSellerId(jsonObject.getLong("sellerId"));
+            supplyChain.setPromoterId(jsonObject.getLong("promoterId"));
+            supplyChain.setPromoterNickName(filterSupplement(jsonObject.getString("promoterNickName")));
+            supplyChain.setActivityId(jsonObject.getLong("activityId"));
+            supplyChain.setOrderAmount(jsonObject.getLong("orderAmount"));
+            supplyChain.setPayAmount(jsonObject.getLong("payAmount"));
+            supplyChain.setRegimentalPromotionRate(jsonObject.getLong("regimentalPromotionRate"));
+            supplyChain.setShareRate(jsonObject.getLong("shareRate"));
+            supplyChain.setBaseAmount(jsonObject.getLong("baseAmount"));
+            supplyChain.setServiceAmount(jsonObject.getLong("serviceAmount"));
+            supplyChain.setRegimentalPromotionAmount(jsonObject.getLong("regimentalPromotionAmount"));
+            supplyChain.setTotalRegimentalSettleAmount(jsonObject.getLong("totalRegimentalSettleAmount"));
+            supplyChain.setStatDate(DateUtils.tempToDate(jsonObject.getLong("orderCreateTime")));
+            supplyChain.setStatHour(DateUtils.getHour(jsonObject.getLong("orderCreateTime")));
+            supplyChain.setItemCommissionRate(itemMap.get(item.getLong("itemId")));
+            Criteria criteria = new Criteria();
+            criteria = Criteria.where("_id").is(itemId);
+            Query query = new Query(criteria);
+            ItemCheck itemCheck = mongoTemplate.findOne(query, ItemCheck.class);
+            if (Check.isNull(itemCheck)) {
+                yufuSupplyChains.add(supplyChain);
+            }
+            if (!Check.isNull(itemCheck)) {
+                String ownership = itemCheck.getOwnership();
+                if ("yufu".equals(ownership)) {
+                    yufuSupplyChains.add(supplyChain);
+                }
+                if ("ruixuan".equals(ownership)) {
+                    ruixuanSupplyChains.add(supplyChain);
+                }
+                if ("miaogousi".equals(ownership)) {
+                    mgsSupplyChains.add(supplyChain);
+                }
+                if ("rocket".equals(ownership)) {
+                    rocketSupplyChains.add(supplyChain);
+                }
+            }
+
+        }
+        try {
+            if (!Check.isNull(yufuSupplyChains)) {
+                yufuSupplyChainMapper.replaceYufuSupplyChains(yufuSupplyChains);
+            }
+
+            if (!Check.isNull(ruixuanSupplyChains)) {
+                yufuSupplyChainMapper.replaceRuixuanSupplyChains(ruixuanSupplyChains);
+            }
+
+            if (!Check.isNull(mgsSupplyChains)) {
+                yufuSupplyChainMapper.replaceMgsSupplyChains(mgsSupplyChains);
+            }
+
+            if (!Check.isNull(rocketSupplyChains)) {
+                yufuSupplyChainMapper.replaceRocketSupplyChains(rocketSupplyChains);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        if (list.size() >= 100) {
+            getOrderList(cookie, offset + 100, orderCreateTimeStart, orderCreateTimeEnd, itemMap);
+        }
+
+    }
+
+    @Override
+    public List<JSONObject> getCookie() {
+        return yufuSupplyChainMapper.getCookie();
+    }
+
+
+    public static String filterSupplement(String content) {
+        StringBuilder sb = new StringBuilder();
+        for (char ch : content.toCharArray()) {
+            if (!Character.isHighSurrogate(ch) && !Character.isLowSurrogate(ch)) {
+                sb.append(ch);
+            }
+        }
+        return sb.toString();
+    }
+
+}
+
+
+