Jelajahi Sumber

止水 初版

zhaoxian 7 bulan lalu
induk
melakukan
f8d7d0e059

+ 37 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/controller/SupplyChainController.java

@@ -69,6 +69,9 @@ public class SupplyChainController extends BaseController {
     @Value("${accept.yuXiuPrivateKey}")
     @Value("${accept.yuXiuPrivateKey}")
     private String yuXiuPrivateKey;
     private String yuXiuPrivateKey;
 
 
+    @Value("${accept.zhishuiPrivateKey}")
+    private String zhishuiPrivateKey;
+
 
 
     @Value("${ownership.id}")
     @Value("${ownership.id}")
     private String ownershipId;
     private String ownershipId;
@@ -2385,6 +2388,40 @@ public class SupplyChainController extends BaseController {
     }
     }
 
 
 
 
+    @PostMapping(value = "/zhishuiAccept")
+    public Map<String, Object> zhishuiAccept(@RequestBody String eventsEncoded) {
+        try {
+            logger.info("止水优选消息订阅");
+            String events = PlatformEventSecurityUtil.decode(eventsEncoded, zhishuiPrivateKey);
+            JSONObject eventJSon = JSONObject.parseObject(events);
+            fxNowService.submit(new Runnable() {
+                @Override
+                public void run() {
+                    try {
+                        if (!Check.isNull(eventJSon)) {
+                            String event = eventJSon.getString("event");
+                            if ("kwaishop_distribute_order_change_notify".equals(event)) {
+                                supplyChainService.updateOrder(eventJSon);
+                            } else if ("kwaishop_distribute_activity_item_change".equals(event)) {
+                                supplyChainService.updateItem(eventJSon);
+                            }
+                        }
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                }
+            });
+        } catch (KsMerchantApiException e) {
+            e.printStackTrace();
+        }
+        //返回成功
+        Map<String, Object> result = new HashMap<>();
+        result.put("result", 1);
+        return result;
+
+    }
+
+
     @GetMapping("/addListKuaishouActivityInfo")
     @GetMapping("/addListKuaishouActivityInfo")
     @ApiOperation(value = "团长查询招商活动列表")
     @ApiOperation(value = "团长查询招商活动列表")
     public void addListKuaishouActivityInfo() {
     public void addListKuaishouActivityInfo() {

+ 2 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/mapper/AccessTokenMapper.java

@@ -27,6 +27,8 @@ public interface AccessTokenMapper {
 
 
     List<KuaishouAccessToken> getYuxiuTokenInfos();
     List<KuaishouAccessToken> getYuxiuTokenInfos();
 
 
+    List<KuaishouAccessToken> getZhishuiTokenInfos();
+
     List<KuaishouAccessToken> getRocketTokenInfos();
     List<KuaishouAccessToken> getRocketTokenInfos();
 
 
     List<JYAccessToken> getJYTokenInfos();
     List<JYAccessToken> getJYTokenInfos();

+ 4 - 2
ruixuan-live/src/main/java/com/ruixuan/isc/mapper/KuaishouItemListMapper.java

@@ -83,6 +83,9 @@ public interface KuaishouItemListMapper {
 
 
     void insertYuxiuItem(KuaishouItemList kuaishouItemList);
     void insertYuxiuItem(KuaishouItemList kuaishouItemList);
 
 
+    void insertZhishuiItem(KuaishouItemList kuaishouItemList);
+
+
     void insertItemCheck(@Param("itemId") Long itemId, @Param("targetOwnershipId") String targetOwnershipId);
     void insertItemCheck(@Param("itemId") Long itemId, @Param("targetOwnershipId") String targetOwnershipId);
 
 
     String getItemOwnership(@Param("itemId") Long itemId);
     String getItemOwnership(@Param("itemId") Long itemId);
@@ -97,9 +100,8 @@ public interface KuaishouItemListMapper {
 
 
     void batchYufuCategory(@Param("adds") List<KuaishouItemCategory> adds);
     void batchYufuCategory(@Param("adds") List<KuaishouItemCategory> adds);
 
 
-    void insertYuXiuItem(KuaishouItemList kuaishouItemList);
-
     void batchYuxiuCategory(@Param("adds") List<KuaishouItemCategory> adds);
     void batchYuxiuCategory(@Param("adds") List<KuaishouItemCategory> adds);
 
 
+    void batchZhishuiCategory(@Param("adds") List<KuaishouItemCategory> adds);
 }
 }
 
 

+ 4 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/mapper/KuaishouPromoterMapper.java

@@ -149,10 +149,14 @@ public interface KuaishouPromoterMapper {
 
 
     List<JYKuaishouPromoter> getYuxiuFailInfo();
     List<JYKuaishouPromoter> getYuxiuFailInfo();
 
 
+    List<JYKuaishouPromoter> getZhishuiFailInfo();
+
     void updateYufuKuaishouPromoterByPromoterId(KuaishouPromoter kuaishouPromoter);
     void updateYufuKuaishouPromoterByPromoterId(KuaishouPromoter kuaishouPromoter);
 
 
     void updateYuxiuKuaishouPromoterByPromoterId(KuaishouPromoter kuaishouPromoter);
     void updateYuxiuKuaishouPromoterByPromoterId(KuaishouPromoter kuaishouPromoter);
 
 
+    void updateZhishuiKuaishouPromoterByPromoterId(KuaishouPromoter kuaishouPromoter);
+
     String getAuthCookie();
     String getAuthCookie();
 
 
     List<Long> getAllJyPromoterList();
     List<Long> getAllJyPromoterList();

+ 14 - 10
ruixuan-live/src/main/java/com/ruixuan/isc/mapper/SupplyChainMapper.java

@@ -3,7 +3,6 @@ package com.ruixuan.isc.mapper;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.ruixuan.isc.entity.KuaiShouActivityInfo;
 import com.ruixuan.isc.entity.KuaiShouActivityInfo;
 import com.ruixuan.isc.entity.KuaiShouActivityOpenItemList;
 import com.ruixuan.isc.entity.KuaiShouActivityOpenItemList;
-import com.ruixuan.isc.entity.KuaishouSupplyChain;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
 
 
 import java.util.List;
 import java.util.List;
@@ -164,6 +163,8 @@ public interface SupplyChainMapper {
 
 
     void replaceYuxiuKuaishouActivityInfo(@Param("list") List<KuaiShouActivityInfo> list);
     void replaceYuxiuKuaishouActivityInfo(@Param("list") List<KuaiShouActivityInfo> list);
 
 
+    void replaceZhishuiKuaishouActivityInfo(@Param("list") List<KuaiShouActivityInfo> list);
+
     void updateMgsKuaishouSupplyChain(@Param("list") List<Long> list);
     void updateMgsKuaishouSupplyChain(@Param("list") List<Long> list);
 
 
     void updateRocketKuaishouSupplyChain(@Param("list") List<Long> list);
     void updateRocketKuaishouSupplyChain(@Param("list") List<Long> list);
@@ -172,6 +173,8 @@ public interface SupplyChainMapper {
 
 
     void updateYuxiuKuaishouSupplyChain(@Param("list") List<Long> list);
     void updateYuxiuKuaishouSupplyChain(@Param("list") List<Long> list);
 
 
+    void updateZhishuiKuaishouSupplyChain(@Param("list") List<Long> list);
+
     List<JSONObject> getBytedanceOrderHourDataList(@Param("date") Long date);
     List<JSONObject> getBytedanceOrderHourDataList(@Param("date") Long date);
 
 
     List<JSONObject> getKuaishouOrderHourDataList(@Param("date") Long date);
     List<JSONObject> getKuaishouOrderHourDataList(@Param("date") Long date);
@@ -188,6 +191,8 @@ public interface SupplyChainMapper {
 
 
     List<Long> getYuxiuKuaishouActivityInfoList();
     List<Long> getYuxiuKuaishouActivityInfoList();
 
 
+    List<Long> getZhishuiKuaishouActivityInfoList();
+
     void replaceKuaiShouActivityOpenItemList(@Param("list") List<KuaiShouActivityOpenItemList> list);
     void replaceKuaiShouActivityOpenItemList(@Param("list") List<KuaiShouActivityOpenItemList> list);
 
 
     void replaceMgsKuaiShouActivityOpenItemList(@Param("list") List<KuaiShouActivityOpenItemList> list);
     void replaceMgsKuaiShouActivityOpenItemList(@Param("list") List<KuaiShouActivityOpenItemList> list);
@@ -198,6 +203,8 @@ public interface SupplyChainMapper {
 
 
     void replaceYuxiuKuaiShouActivityOpenItemList(@Param("list") List<KuaiShouActivityOpenItemList> list);
     void replaceYuxiuKuaiShouActivityOpenItemList(@Param("list") List<KuaiShouActivityOpenItemList> list);
 
 
+    void replaceZhishuiKuaiShouActivityOpenItemList(@Param("list") List<KuaiShouActivityOpenItemList> list);
+
     List<JSONObject> getKsChannelGmvHourByDate(@Param("userList") List<Long> userList, @Param("date") Integer date, @Param("hourType") Integer hourType);
     List<JSONObject> getKsChannelGmvHourByDate(@Param("userList") List<Long> userList, @Param("date") Integer date, @Param("hourType") Integer hourType);
 
 
     List<JSONObject> getKsCourtshipGmvHourByDate(@Param("userList") List<Long> userList, @Param("date") Integer date, @Param("hourType") Integer hourType);
     List<JSONObject> getKsCourtshipGmvHourByDate(@Param("userList") List<Long> userList, @Param("date") Integer date, @Param("hourType") Integer hourType);
@@ -218,6 +225,8 @@ public interface SupplyChainMapper {
 
 
     int updateYuxiuOrderRegimentalSettleAmount(@Param("oid") Long oid, @Param("cpsOrderStatus") Integer cpsOrderStatus);
     int updateYuxiuOrderRegimentalSettleAmount(@Param("oid") Long oid, @Param("cpsOrderStatus") Integer cpsOrderStatus);
 
 
+    int updateZhishuiOrderRegimentalSettleAmount(@Param("oid") Long oid, @Param("cpsOrderStatus") Integer cpsOrderStatus);
+
     int updateRuixuanOrder(@Param("oid") Long oid, @Param("cpsOrderStatus") Integer cpsOrderStatus);
     int updateRuixuanOrder(@Param("oid") Long oid, @Param("cpsOrderStatus") Integer cpsOrderStatus);
 
 
     int updateMgsOrder(@Param("oid") Long oid, @Param("cpsOrderStatus") Integer cpsOrderStatus);
     int updateMgsOrder(@Param("oid") Long oid, @Param("cpsOrderStatus") Integer cpsOrderStatus);
@@ -226,7 +235,9 @@ public interface SupplyChainMapper {
 
 
     int updateYufuOrder(@Param("oid") Long oid, @Param("cpsOrderStatus") Integer cpsOrderStatus);
     int updateYufuOrder(@Param("oid") Long oid, @Param("cpsOrderStatus") Integer cpsOrderStatus);
 
 
-    int updateYuxiuOrder(@Param("oid") Long oid, @Param("cpsOrderStatus") Integer cpsOrderStatus);
+    int updateYuXiuOrder(@Param("oid") Long oid, @Param("cpsOrderStatus") Integer cpsOrderStatus);
+
+    int updateZhishuiOrder(@Param("oid") Long oid, @Param("cpsOrderStatus") Integer cpsOrderStatus);
 
 
     void updateKuaiShouActivityOpenItemList(KuaiShouActivityOpenItemList list);
     void updateKuaiShouActivityOpenItemList(KuaiShouActivityOpenItemList list);
 
 
@@ -238,6 +249,7 @@ public interface SupplyChainMapper {
 
 
     void updateYuxiuKuaiShouActivityOpenItemList(KuaiShouActivityOpenItemList list);
     void updateYuxiuKuaiShouActivityOpenItemList(KuaiShouActivityOpenItemList list);
 
 
+    void updateZhishuiKuaiShouActivityOpenItemList(KuaiShouActivityOpenItemList list);
 
 
     List<JSONObject> shopList(Map<String, Object> requestMap);
     List<JSONObject> shopList(Map<String, Object> requestMap);
 
 
@@ -254,12 +266,4 @@ public interface SupplyChainMapper {
     List<JSONObject> getBytedanceChannelGmvHourByDateRoi(@Param("userList") List<Long> userList, @Param("date") Long date, @Param("hourType") Integer hourType);
     List<JSONObject> getBytedanceChannelGmvHourByDateRoi(@Param("userList") List<Long> userList, @Param("date") Long date, @Param("hourType") Integer hourType);
 
 
     List<JSONObject> getBytedanceCourtshipGmvHourByDateRoi(@Param("userList") List<Long> userList, @Param("date") Long date, @Param("hourType") Integer hourType);
     List<JSONObject> getBytedanceCourtshipGmvHourByDateRoi(@Param("userList") List<Long> userList, @Param("date") Long date, @Param("hourType") Integer hourType);
-
-    int updateYuXiuOrder(@Param("oid") Long oid, @Param("cpsOrderStatus") Integer cpsOrderStatus);
-
-    int updateYuXiuOrderRegimentalSettleAmount(@Param("oid") Long oid, @Param("cpsOrderStatus") Integer cpsOrderStatus);
-
-    int updatezhishuiOrderRegimentalSettleAmount(Long oid, @Param("cpsOrderStatus") Integer cpsOrderStatus);
-
-    int updateZhishuiOrder(@Param("oid") Long oid, @Param("cpsOrderStatus") Integer cpsOrderStatus);
 }
 }

+ 2 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/service/IAccessTokenService.java

@@ -27,6 +27,8 @@ public interface IAccessTokenService {
 
 
     List<KuaishouAccessToken> getYuxiuTokenInfos();
     List<KuaishouAccessToken> getYuxiuTokenInfos();
 
 
+    List<KuaishouAccessToken> getZhishuiTokenInfos();
+
     List<KuaishouAccessToken> getRocketTokenInfos();
     List<KuaishouAccessToken> getRocketTokenInfos();
 
 
 
 

+ 5 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/AccessTokenServiceImpl.java

@@ -191,6 +191,11 @@ public class AccessTokenServiceImpl implements IAccessTokenService {
     }
     }
 
 
     @Override
     @Override
+    public List<KuaishouAccessToken> getZhishuiTokenInfos() {
+        return accessTokenMapper.getZhishuiTokenInfos();
+    }
+
+    @Override
     public List<KuaishouAccessToken> getRocketTokenInfos() {
     public List<KuaishouAccessToken> getRocketTokenInfos() {
         return accessTokenMapper.getRocketTokenInfos();
         return accessTokenMapper.getRocketTokenInfos();
     }
     }

+ 5 - 1
ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouItemListServiceImpl.java

@@ -237,7 +237,10 @@ public class KuaishouItemListServiceImpl implements IKuaishouItemListService {
             kuaishouItemListMapper.insertYufuItem(kuaishouItemList);
             kuaishouItemListMapper.insertYufuItem(kuaishouItemList);
         }
         }
         if (targetOwnershipId.equals("yuxiu")) {
         if (targetOwnershipId.equals("yuxiu")) {
-            kuaishouItemListMapper.insertYuXiuItem(kuaishouItemList);
+            kuaishouItemListMapper.insertYuxiuItem(kuaishouItemList);
+        }
+        if (targetOwnershipId.equals("zhishui")) {
+            kuaishouItemListMapper.insertZhishuiItem(kuaishouItemList);
         }
         }
         JSONObject mongoVo = new JSONObject();
         JSONObject mongoVo = new JSONObject();
         mongoVo.put("_id", kuaishouItemList.getItemId());
         mongoVo.put("_id", kuaishouItemList.getItemId());
@@ -365,6 +368,7 @@ public class KuaishouItemListServiceImpl implements IKuaishouItemListService {
         kuaishouItemListMapper.batchRocketCategory(adds);
         kuaishouItemListMapper.batchRocketCategory(adds);
         kuaishouItemListMapper.batchYufuCategory(adds);
         kuaishouItemListMapper.batchYufuCategory(adds);
         kuaishouItemListMapper.batchYuxiuCategory(adds);
         kuaishouItemListMapper.batchYuxiuCategory(adds);
+        kuaishouItemListMapper.batchZhishuiCategory(adds);
 
 
         return 0;
         return 0;
     }
     }

+ 81 - 10
ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouPromoterServiceImpl.java

@@ -351,7 +351,7 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
             String content = "";
             String content = "";
             if ("2".equals(mediaId)) {
             if ("2".equals(mediaId)) {
                 //睡眠: 随机数3的倍数 3、6、9 ...33s
                 //睡眠: 随机数3的倍数 3、6、9 ...33s
-                Thread.sleep(1000 * (int) (1+Math.random() * 11)*3);
+                Thread.sleep(1000 * (int) (1 + Math.random() * 11) * 3);
                 content = HttpUtil.httpPostRequest(startIpPath + "promoterInfo/getPromoterId", param, null);
                 content = HttpUtil.httpPostRequest(startIpPath + "promoterInfo/getPromoterId", param, null);
             } else {
             } else {
                 Thread.sleep(60000);
                 Thread.sleep(60000);
@@ -414,7 +414,7 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
             }
             }
 
 
             //睡眠: 随机数3的倍数 3、6、9 ...33s
             //睡眠: 随机数3的倍数 3、6、9 ...33s
-            Thread.sleep(1000 * (int) (1+Math.random() * 11)*3);
+            Thread.sleep(1000 * (int) (1 + Math.random() * 11) * 3);
 
 
             /*更新达人数据*/
             /*更新达人数据*/
             Map<String, Object> param = new HashMap<>();
             Map<String, Object> param = new HashMap<>();
@@ -453,7 +453,7 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
     }
     }
 
 
     /**
     /**
-     * 同步更新数据
+     * Miaogousi同步更新数据
      */
      */
     private void editMiaogousiPromoter(Long id, String mediaId, String promoterId, boolean flag) {
     private void editMiaogousiPromoter(Long id, String mediaId, String promoterId, boolean flag) {
         try {
         try {
@@ -468,7 +468,7 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
             }
             }
 
 
             //睡眠: 随机数3的倍数 3、6、9 ...33s
             //睡眠: 随机数3的倍数 3、6、9 ...33s
-            Thread.sleep(1000 * (int) (1+Math.random() * 11)*3);
+            Thread.sleep(1000 * (int) (1 + Math.random() * 11) * 3);
 
 
             /*更新达人数据*/
             /*更新达人数据*/
             Map<String, Object> param = new HashMap<>();
             Map<String, Object> param = new HashMap<>();
@@ -508,7 +508,7 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
 
 
 
 
     /**
     /**
-     * 同步更新数据
+     * Rocket同步更新数据
      */
      */
     private void editRocketPromoter(Long id, String mediaId, String promoterId, boolean flag) {
     private void editRocketPromoter(Long id, String mediaId, String promoterId, boolean flag) {
         try {
         try {
@@ -523,7 +523,7 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
             }
             }
 
 
             //睡眠: 随机数3的倍数 3、6、9 ...33s
             //睡眠: 随机数3的倍数 3、6、9 ...33s
-            Thread.sleep(1000 * (int) (1+Math.random() * 11)*3);
+            Thread.sleep(1000 * (int) (1 + Math.random() * 11) * 3);
 
 
             /*更新达人数据*/
             /*更新达人数据*/
             Map<String, Object> param = new HashMap<>();
             Map<String, Object> param = new HashMap<>();
@@ -561,7 +561,7 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
 
 
 
 
     /**
     /**
-     * 同步更新数据
+     * Yufu同步更新数据
      */
      */
     private void editYufuPromoter(Long id, String mediaId, String promoterId, boolean flag) {
     private void editYufuPromoter(Long id, String mediaId, String promoterId, boolean flag) {
         try {
         try {
@@ -576,7 +576,7 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
             }
             }
 
 
             //睡眠: 随机数3的倍数 3、6、9 ...33s
             //睡眠: 随机数3的倍数 3、6、9 ...33s
-            Thread.sleep(1000 * (int) (1+Math.random() * 11)*3);
+            Thread.sleep(1000 * (int) (1 + Math.random() * 11) * 3);
 
 
             /*更新达人数据*/
             /*更新达人数据*/
             Map<String, Object> param = new HashMap<>();
             Map<String, Object> param = new HashMap<>();
@@ -613,7 +613,7 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
     }
     }
 
 
     /**
     /**
-     * 同步更新数据
+     * Yuxiu同步更新数据
      */
      */
     private void editYuxiuPromoter(Long id, String mediaId, String promoterId, boolean flag) {
     private void editYuxiuPromoter(Long id, String mediaId, String promoterId, boolean flag) {
         try {
         try {
@@ -628,7 +628,7 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
             }
             }
 
 
             //睡眠: 随机数3的倍数 3、6、9 ...33s
             //睡眠: 随机数3的倍数 3、6、9 ...33s
-            Thread.sleep(1000 * (int) (1+Math.random() * 11)*3);
+            Thread.sleep(1000 * (int) (1 + Math.random() * 11) * 3);
 
 
             /*更新达人数据*/
             /*更新达人数据*/
             Map<String, Object> param = new HashMap<>();
             Map<String, Object> param = new HashMap<>();
@@ -664,6 +664,59 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
         }
         }
     }
     }
 
 
+
+    /**
+     * zhishui同步更新数据
+     */
+    private void editZhishuiPromoter(Long id, String mediaId, String promoterId, boolean flag) {
+        try {
+            if (flag) {
+                /*缓存标记,每日第一次访问调用该接口,更新达人部分(昵称,省市,粉丝,总销售,头像等)数据*/
+                String key = DateUtils.getDate() + "zhishui_" + promoterId + "_" + id;
+                String value = (String) redisUtil.get(key);
+                if (Check.isNotNull(value) && "1".equals(value)) {
+                    return;
+                }
+                redisUtil.set(key, "1", 60 * 60 * 24);
+            }
+
+            //睡眠: 随机数3的倍数 3、6、9 ...33s
+            Thread.sleep(1000 * (int) (1 + Math.random() * 11) * 3);
+
+            /*更新达人数据*/
+            Map<String, Object> param = new HashMap<>();
+            param.put("promoterId", promoterId);
+            param.put("mediaId", mediaId);
+            Long startTime = System.currentTimeMillis();
+            String content = HttpUtil.httpPostRequest(startIpPath + "promoterInfo/getPromoterId", param, null);
+            JSONObject result = JSONObject.parseObject(content);
+            if (Check.isNotNull(result) && Check.isNotNull(result.getString("promoterNickName"))) {
+                log.info("--------------------Zhishui达人更新\n【入参】:{}\n【返回结果】:{}", param, result.toJSONString());
+                String province = "";
+                if (Check.isNotNull(result.getString("province"))) {
+                    province = result.getString("province").concat("-").concat(result.getString("city"));
+                }
+                KuaishouPromoter kuaishouPromoter = new KuaishouPromoter(
+                        id,
+                        result.getString("promoterNickName"),
+                        province,
+                        result.getString("promoterHeadImgUrl"),
+                        result.getString("fanNum"),
+                        result.getString("avgVideoSales"),
+                        result.getString("videoSales"),
+                        result.getString("totalSale"),
+                        promoterId
+                );
+                kuaishouPromoterMapper.updateZhishuiKuaishouPromoterByPromoterId(kuaishouPromoter);
+            } else {
+                log.error("更新达人失败,达人ID:{} 【返回结果】:{}", promoterId, result);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("更新达人信息异常", e);
+        }
+    }
+
     @Override
     @Override
     public JSONObject insertKuaishouPromoter3(JYKuaishouPromoter promoter) {
     public JSONObject insertKuaishouPromoter3(JYKuaishouPromoter promoter) {
         JSONObject result = new JSONObject();
         JSONObject result = new JSONObject();
@@ -739,6 +792,7 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
         promoters.add(rocketInfo());
         promoters.add(rocketInfo());
         promoters.add(yufuInfo());
         promoters.add(yufuInfo());
         promoters.add(yuxiuInfo());
         promoters.add(yuxiuInfo());
+        promoters.add(zhishuiInfo());
         return Result.success("达人数据更新 -------------<睿选>共计:" + list.size() + "条", promoters);
         return Result.success("达人数据更新 -------------<睿选>共计:" + list.size() + "条", promoters);
     }
     }
 
 
@@ -827,6 +881,23 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
         return "-------------yuxiu共计" + list.size() + "条,达人id: " + promoters.toString();
         return "-------------yuxiu共计" + list.size() + "条,达人id: " + promoters.toString();
     }
     }
 
 
+    //zhishui
+    public String zhishuiInfo() {
+        List<String> promoters = new ArrayList<>();
+        List<JYKuaishouPromoter> list = kuaishouPromoterMapper.getZhishuiFailInfo();
+        if (!Check.isNull(list)) {
+            list.forEach(kuaishouPromoter -> editPromoterService.submit(() -> {
+                try {
+                    editZhishuiPromoter(kuaishouPromoter.getId(), kuaishouPromoter.getMediaId(), kuaishouPromoter.getPromoterId(), false);
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }));
+            list.forEach(kuaishouPromoter -> promoters.add(kuaishouPromoter.getPromoterId()));
+        }
+        return "-------------zhishui共计" + list.size() + "条,达人id: " + promoters.toString();
+    }
+
     @Override
     @Override
     public int addFollowUpRecords(JSONObject result) {
     public int addFollowUpRecords(JSONObject result) {
         return kuaishouPromoterMapper.addFollowUpRecords(result);
         return kuaishouPromoterMapper.addFollowUpRecords(result);

+ 274 - 8
ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/SupplyChainServiceImpl.java

@@ -458,6 +458,11 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
             if (yuxiu > 0) {
             if (yuxiu > 0) {
                 return yuxiu;
                 return yuxiu;
             }
             }
+
+            int zhishui = supplyChainMapper.updateZhishuiOrder(oid, cpsOrderStatus);
+            if (zhishui > 0) {
+                return zhishui;
+            }
         }
         }
         if ("miaogousi".equals(ownershipId)) {
         if ("miaogousi".equals(ownershipId)) {
             int mgs = supplyChainMapper.updateMgsOrder(oid, cpsOrderStatus);
             int mgs = supplyChainMapper.updateMgsOrder(oid, cpsOrderStatus);
@@ -481,6 +486,10 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
                 return yuxiu;
                 return yuxiu;
             }
             }
 
 
+            int zhishui = supplyChainMapper.updateZhishuiOrder(oid, cpsOrderStatus);
+            if (zhishui > 0) {
+                return zhishui;
+            }
         }
         }
         if ("rocket".equals(ownershipId)) {
         if ("rocket".equals(ownershipId)) {
             int rocket = supplyChainMapper.updateRocketOrder(oid, cpsOrderStatus);
             int rocket = supplyChainMapper.updateRocketOrder(oid, cpsOrderStatus);
@@ -503,6 +512,10 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
             if (yuxiu > 0) {
             if (yuxiu > 0) {
                 return yuxiu;
                 return yuxiu;
             }
             }
+            int zhishui = supplyChainMapper.updateZhishuiOrder(oid, cpsOrderStatus);
+            if (zhishui > 0) {
+                return zhishui;
+            }
 
 
         }
         }
         if ("yufu".equals(ownershipId)) {
         if ("yufu".equals(ownershipId)) {
@@ -526,6 +539,10 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
             if (yuxiu > 0) {
             if (yuxiu > 0) {
                 return yuxiu;
                 return yuxiu;
             }
             }
+            int zhishui = supplyChainMapper.updateZhishuiOrder(oid, cpsOrderStatus);
+            if (zhishui > 0) {
+                return zhishui;
+            }
         }
         }
 
 
         if ("yuxiu".equals(ownershipId)) {
         if ("yuxiu".equals(ownershipId)) {
@@ -549,6 +566,40 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
             if (yufu > 0) {
             if (yufu > 0) {
                 return yufu;
                 return yufu;
             }
             }
+            int zhishui = supplyChainMapper.updateZhishuiOrder(oid, cpsOrderStatus);
+            if (zhishui > 0) {
+                return zhishui;
+            }
+
+        }
+
+        if ("zhishui".equals(ownershipId)) {
+            int zhishui = supplyChainMapper.updateZhishuiOrder(oid, cpsOrderStatus);
+            if (zhishui > 0) {
+                return zhishui;
+            }
+            int yuxiu = supplyChainMapper.updateYuXiuOrder(oid, cpsOrderStatus);
+            if (yuxiu > 0) {
+                return yuxiu;
+            }
+            int ruixuan = supplyChainMapper.updateRuixuanOrder(oid, cpsOrderStatus);
+            if (ruixuan > 0) {
+                return ruixuan;
+            }
+            int mgs = supplyChainMapper.updateMgsOrder(oid, cpsOrderStatus);
+            if (mgs > 0) {
+                return mgs;
+            }
+            int rocket = supplyChainMapper.updateRocketOrder(oid, cpsOrderStatus);
+            if (rocket > 0) {
+                return rocket;
+            }
+            int yufu = supplyChainMapper.updateYufuOrder(oid, cpsOrderStatus);
+            if (yufu > 0) {
+                return yufu;
+            }
+
+
         }
         }
 
 
         if ("zhishui".equals(ownershipId)) {
         if ("zhishui".equals(ownershipId)) {
@@ -605,7 +656,7 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
             if (yuxiu > 0) {
             if (yuxiu > 0) {
                 return yuxiu;
                 return yuxiu;
             }
             }
-            int zhishui = supplyChainMapper.updatezhishuiOrderRegimentalSettleAmount(oid, cpsOrderStatus);
+            int zhishui = supplyChainMapper.updateZhishuiOrderRegimentalSettleAmount(oid, cpsOrderStatus);
             if (zhishui > 0) {
             if (zhishui > 0) {
                 return zhishui;
                 return zhishui;
             }
             }
@@ -632,7 +683,7 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
             if (yuxiu > 0) {
             if (yuxiu > 0) {
                 return yuxiu;
                 return yuxiu;
             }
             }
-            int zhishui = supplyChainMapper.updatezhishuiOrderRegimentalSettleAmount(oid, cpsOrderStatus);
+            int zhishui = supplyChainMapper.updateZhishuiOrderRegimentalSettleAmount(oid, cpsOrderStatus);
             if (zhishui > 0) {
             if (zhishui > 0) {
                 return zhishui;
                 return zhishui;
             }
             }
@@ -659,7 +710,7 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
             if (yuxiu > 0) {
             if (yuxiu > 0) {
                 return yuxiu;
                 return yuxiu;
             }
             }
-            int zhishui = supplyChainMapper.updatezhishuiOrderRegimentalSettleAmount(oid, cpsOrderStatus);
+            int zhishui = supplyChainMapper.updateZhishuiOrderRegimentalSettleAmount(oid, cpsOrderStatus);
             if (zhishui > 0) {
             if (zhishui > 0) {
                 return zhishui;
                 return zhishui;
             }
             }
@@ -675,12 +726,10 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
             if (ruixuan > 0) {
             if (ruixuan > 0) {
                 return ruixuan;
                 return ruixuan;
             }
             }
-
             int mgs = supplyChainMapper.updateMgsOrderRegimentalSettleAmount(oid, cpsOrderStatus);
             int mgs = supplyChainMapper.updateMgsOrderRegimentalSettleAmount(oid, cpsOrderStatus);
             if (mgs > 0) {
             if (mgs > 0) {
                 return mgs;
                 return mgs;
             }
             }
-
             int rocket = supplyChainMapper.updateRocketOrderRegimentalSettleAmount(oid, cpsOrderStatus);
             int rocket = supplyChainMapper.updateRocketOrderRegimentalSettleAmount(oid, cpsOrderStatus);
             if (rocket > 0) {
             if (rocket > 0) {
                 return rocket;
                 return rocket;
@@ -691,7 +740,7 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
                 return yuxiu;
                 return yuxiu;
             }
             }
 
 
-            int zhishui = supplyChainMapper.updatezhishuiOrderRegimentalSettleAmount(oid, cpsOrderStatus);
+            int zhishui = supplyChainMapper.updateZhishuiOrderRegimentalSettleAmount(oid, cpsOrderStatus);
             if (zhishui > 0) {
             if (zhishui > 0) {
                 return zhishui;
                 return zhishui;
             }
             }
@@ -717,7 +766,7 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
             if (yufu > 0) {
             if (yufu > 0) {
                 return yufu;
                 return yufu;
             }
             }
-            int zhishui = supplyChainMapper.updatezhishuiOrderRegimentalSettleAmount(oid, cpsOrderStatus);
+            int zhishui = supplyChainMapper.updateZhishuiOrderRegimentalSettleAmount(oid, cpsOrderStatus);
             if (zhishui > 0) {
             if (zhishui > 0) {
                 return zhishui;
                 return zhishui;
             }
             }
@@ -725,7 +774,7 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
         }
         }
 
 
         if ("zhishui".equals(ownershipId)) {
         if ("zhishui".equals(ownershipId)) {
-            int zhishui = supplyChainMapper.updatezhishuiOrderRegimentalSettleAmount(oid, cpsOrderStatus);
+            int zhishui = supplyChainMapper.updateZhishuiOrderRegimentalSettleAmount(oid, cpsOrderStatus);
             if (zhishui > 0) {
             if (zhishui > 0) {
                 return zhishui;
                 return zhishui;
             }
             }
@@ -805,6 +854,12 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
             getYuxiuInfo(accessToken, beginTime, endTime, url, pcursor, 1);
             getYuxiuInfo(accessToken, beginTime, endTime, url, pcursor, 1);
         }
         }
 
 
+        Thread.sleep(3000);
+        List<KuaishouAccessToken> zhishuiTokens = accessTokenService.getZhishuiTokenInfos();
+        for (KuaishouAccessToken accessToken : zhishuiTokens) {
+            getZhishuiInfo(accessToken, beginTime, endTime, url, pcursor, 1);
+        }
+
     }
     }
 
 
     private void getInfo(KuaishouAccessToken accessToken, Long beginTime, Long endTime, String url, String pcursor, Integer counts) throws InterruptedException {
     private void getInfo(KuaishouAccessToken accessToken, Long beginTime, Long endTime, String url, String pcursor, Integer counts) throws InterruptedException {
@@ -813,6 +868,7 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
         List<Long> rocketList = new ArrayList<>();
         List<Long> rocketList = new ArrayList<>();
         List<Long> yufuList = new ArrayList<>();
         List<Long> yufuList = new ArrayList<>();
         List<Long> yuxiuList = new ArrayList<>();
         List<Long> yuxiuList = new ArrayList<>();
+        List<Long> zhishuiList = new ArrayList<>();
         String appKey = accessToken.getAppKey();
         String appKey = accessToken.getAppKey();
         String signSecret = accessToken.getSignSecret();
         String signSecret = accessToken.getSignSecret();
         if (Check.isNull(signSecret) || Check.isNull(appKey)) {
         if (Check.isNull(signSecret) || Check.isNull(appKey)) {
@@ -881,6 +937,9 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
                             if ("yuxiu".equals(ownership)) {
                             if ("yuxiu".equals(ownership)) {
                                 yuxiuList.add(info.getLong("oid"));
                                 yuxiuList.add(info.getLong("oid"));
                             }
                             }
+                            if ("zhishui".equals(ownership)) {
+                                zhishuiList.add(info.getLong("oid"));
+                            }
                         }
                         }
                     }
                     }
 
 
@@ -910,6 +969,9 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
         if (!Check.isNull(yuxiuList)) {
         if (!Check.isNull(yuxiuList)) {
             supplyChainMapper.updateYuxiuKuaishouSupplyChain(yuxiuList);
             supplyChainMapper.updateYuxiuKuaishouSupplyChain(yuxiuList);
         }
         }
+        if (!Check.isNull(zhishuiList)) {
+            supplyChainMapper.updateZhishuiKuaishouSupplyChain(zhishuiList);
+        }
         if (!"nomore".equals(pcursor)) {
         if (!"nomore".equals(pcursor)) {
             getInfo(accessToken, beginTime, endTime, url, pcursor, 1);
             getInfo(accessToken, beginTime, endTime, url, pcursor, 1);
         }
         }
@@ -921,6 +983,7 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
         List<Long> rocketList = new ArrayList<>();
         List<Long> rocketList = new ArrayList<>();
         List<Long> yufuList = new ArrayList<>();
         List<Long> yufuList = new ArrayList<>();
         List<Long> yuxiuList = new ArrayList<>();
         List<Long> yuxiuList = new ArrayList<>();
+        List<Long> zhishuiList = new ArrayList<>();
 
 
         String appKey = accessToken.getAppKey();
         String appKey = accessToken.getAppKey();
         String signSecret = accessToken.getSignSecret();
         String signSecret = accessToken.getSignSecret();
@@ -989,6 +1052,9 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
                         if ("yuxiu".equals(ownership)) {
                         if ("yuxiu".equals(ownership)) {
                             yuxiuList.add(info.getLong("oid"));
                             yuxiuList.add(info.getLong("oid"));
                         }
                         }
+                        if ("zhishui".equals(ownership)) {
+                            zhishuiList.add(info.getLong("oid"));
+                        }
                     }
                     }
                 }
                 }
             }
             }
@@ -1015,6 +1081,9 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
         if (!Check.isNull(yuxiuList)) {
         if (!Check.isNull(yuxiuList)) {
             supplyChainMapper.updateYuxiuKuaishouSupplyChain(yuxiuList);
             supplyChainMapper.updateYuxiuKuaishouSupplyChain(yuxiuList);
         }
         }
+        if (!Check.isNull(zhishuiList)) {
+            supplyChainMapper.updateZhishuiKuaishouSupplyChain(zhishuiList);
+        }
         if (!"nomore".equals(pcursor)) {
         if (!"nomore".equals(pcursor)) {
             getMgsInfo(accessToken, beginTime, endTime, url, pcursor, 1);
             getMgsInfo(accessToken, beginTime, endTime, url, pcursor, 1);
         }
         }
@@ -1026,6 +1095,7 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
         List<Long> rocketList = new ArrayList<>();
         List<Long> rocketList = new ArrayList<>();
         List<Long> yufuList = new ArrayList<>();
         List<Long> yufuList = new ArrayList<>();
         List<Long> yuxiuList = new ArrayList<>();
         List<Long> yuxiuList = new ArrayList<>();
+        List<Long> zhishuiList = new ArrayList<>();
 
 
         String appKey = accessToken.getAppKey();
         String appKey = accessToken.getAppKey();
         String signSecret = accessToken.getSignSecret();
         String signSecret = accessToken.getSignSecret();
@@ -1093,6 +1163,9 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
                         if ("yuxiu".equals(ownership)) {
                         if ("yuxiu".equals(ownership)) {
                             yuxiuList.add(info.getLong("oid"));
                             yuxiuList.add(info.getLong("oid"));
                         }
                         }
+                        if ("zhishui".equals(ownership)) {
+                            zhishuiList.add(info.getLong("oid"));
+                        }
                     }
                     }
                 }
                 }
             }
             }
@@ -1118,6 +1191,9 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
         if (!Check.isNull(yuxiuList)) {
         if (!Check.isNull(yuxiuList)) {
             supplyChainMapper.updateYuxiuKuaishouSupplyChain(yuxiuList);
             supplyChainMapper.updateYuxiuKuaishouSupplyChain(yuxiuList);
         }
         }
+        if (!Check.isNull(zhishuiList)) {
+            supplyChainMapper.updateZhishuiKuaishouSupplyChain(zhishuiList);
+        }
         if (!"nomore".equals(pcursor)) {
         if (!"nomore".equals(pcursor)) {
             getRocketInfo(accessToken, beginTime, endTime, url, pcursor, 1);
             getRocketInfo(accessToken, beginTime, endTime, url, pcursor, 1);
         }
         }
@@ -1130,6 +1206,8 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
         List<Long> rocketList = new ArrayList<>();
         List<Long> rocketList = new ArrayList<>();
         List<Long> yufuList = new ArrayList<>();
         List<Long> yufuList = new ArrayList<>();
         List<Long> yuxiuList = new ArrayList<>();
         List<Long> yuxiuList = new ArrayList<>();
+        List<Long> zhishuiList = new ArrayList<>();
+
         String appKey = accessToken.getAppKey();
         String appKey = accessToken.getAppKey();
         String signSecret = accessToken.getSignSecret();
         String signSecret = accessToken.getSignSecret();
         if (Check.isNull(signSecret) || Check.isNull(appKey)) {
         if (Check.isNull(signSecret) || Check.isNull(appKey)) {
@@ -1196,6 +1274,9 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
                         if ("yuxiu".equals(ownership)) {
                         if ("yuxiu".equals(ownership)) {
                             yuxiuList.add(info.getLong("oid"));
                             yuxiuList.add(info.getLong("oid"));
                         }
                         }
+                        if ("zhishui".equals(ownership)) {
+                            zhishuiList.add(info.getLong("oid"));
+                        }
                     }
                     }
                 }
                 }
             }
             }
@@ -1221,6 +1302,9 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
         if (!Check.isNull(yuxiuList)) {
         if (!Check.isNull(yuxiuList)) {
             supplyChainMapper.updateYuxiuKuaishouSupplyChain(yuxiuList);
             supplyChainMapper.updateYuxiuKuaishouSupplyChain(yuxiuList);
         }
         }
+        if (!Check.isNull(zhishuiList)) {
+            supplyChainMapper.updateZhishuiKuaishouSupplyChain(zhishuiList);
+        }
         if (!"nomore".equals(pcursor)) {
         if (!"nomore".equals(pcursor)) {
             getYufuInfo(accessToken, beginTime, endTime, url, pcursor, 1);
             getYufuInfo(accessToken, beginTime, endTime, url, pcursor, 1);
         }
         }
@@ -1232,6 +1316,9 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
         List<Long> rocketList = new ArrayList<>();
         List<Long> rocketList = new ArrayList<>();
         List<Long> yufuList = new ArrayList<>();
         List<Long> yufuList = new ArrayList<>();
         List<Long> yuxiuList = new ArrayList<>();
         List<Long> yuxiuList = new ArrayList<>();
+        List<Long> zhishuiList = new ArrayList<>();
+
+
         String appKey = accessToken.getAppKey();
         String appKey = accessToken.getAppKey();
         String signSecret = accessToken.getSignSecret();
         String signSecret = accessToken.getSignSecret();
         if (Check.isNull(signSecret) || Check.isNull(appKey)) {
         if (Check.isNull(signSecret) || Check.isNull(appKey)) {
@@ -1298,6 +1385,9 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
                         if ("yuxiu".equals(ownership)) {
                         if ("yuxiu".equals(ownership)) {
                             yuxiuList.add(info.getLong("oid"));
                             yuxiuList.add(info.getLong("oid"));
                         }
                         }
+                        if ("zhishui".equals(ownership)) {
+                            zhishuiList.add(info.getLong("oid"));
+                        }
                     }
                     }
                 }
                 }
             }
             }
@@ -1323,11 +1413,125 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
         if (!Check.isNull(yufuList)) {
         if (!Check.isNull(yufuList)) {
             supplyChainMapper.updateYufuKuaishouSupplyChain(yufuList);
             supplyChainMapper.updateYufuKuaishouSupplyChain(yufuList);
         }
         }
+        if (!Check.isNull(zhishuiList)) {
+            supplyChainMapper.updateZhishuiKuaishouSupplyChain(zhishuiList);
+        }
         if (!"nomore".equals(pcursor)) {
         if (!"nomore".equals(pcursor)) {
             getYuxiuInfo(accessToken, beginTime, endTime, url, pcursor, 1);
             getYuxiuInfo(accessToken, beginTime, endTime, url, pcursor, 1);
         }
         }
     }
     }
 
 
+    private void getZhishuiInfo(KuaishouAccessToken accessToken, Long beginTime, Long endTime, String url, String pcursor, Integer counts) throws InterruptedException {
+        List<Long> ruixuanList = new ArrayList<>();
+        List<Long> mgsList = new ArrayList<>();
+        List<Long> rocketList = new ArrayList<>();
+        List<Long> yufuList = new ArrayList<>();
+        List<Long> yuxiuList = new ArrayList<>();
+        List<Long> zhishuiList = new ArrayList<>();
+
+        String appKey = accessToken.getAppKey();
+        String signSecret = accessToken.getSignSecret();
+        if (Check.isNull(signSecret) || Check.isNull(appKey)) {
+            return;
+        }
+        AccessTokenKsMerchantClient client = new AccessTokenKsMerchantClient(url, appKey, signSecret);
+        OpenDistributionCpsLeaderOrderCursorListRequest request = new OpenDistributionCpsLeaderOrderCursorListRequest();
+        request.setAccessToken(accessToken.getAccessToken());
+        request.setApiMethodVersion(1L);
+
+        //排序类型 [1:按指定查询类型降序] [2:按指定查询类型升序]
+        request.setSortType(1);
+        //查询类型 [1:按分销订单创建时间查询] [2:按分销订单更新时间查询][4:按订单实际创建时间查询]
+        request.setQueryType(2);
+        //分销订单状态 [0:全部订单] [30:已付款] [50:已收货] [60:已结算] [80:已失效]
+        request.setCpsOrderStatus(0);
+        request.setDistributorId(0l);
+        request.setBeginTime(beginTime);
+        request.setEndTime(endTime);
+        request.setPcursor(pcursor);
+        request.setPageize(100);
+        request.setFundType(1);
+
+        OpenDistributionCpsLeaderOrderCursorListResponse response = null;
+        try {
+            response = client.execute(request);
+        } catch (KsMerchantApiException e) {
+            e.printStackTrace();
+        }
+        JSONObject obj = JSONObject.parseObject(GsonUtils.toJSON(response));
+        String code = obj.getString("code");
+        if ("1".equals(code)) {
+            JSONObject data = obj.getJSONObject("data");
+            pcursor = data.getString("pcursor");
+            JSONArray orderView = data.getJSONArray("orderView");
+            for (int i = 0; i < orderView.size(); i++) {
+                JSONObject info = orderView.getJSONObject(i);
+                Integer sendStatus = info.getInteger("sendStatus");
+                if (Check.isNotNull(sendStatus) && sendStatus == 1) {
+                    JSONArray cpsOrderProductView = info.getJSONArray("cpsOrderProductView");
+                    JSONObject itemJson = cpsOrderProductView.getJSONObject(0);
+                    Long itemId = itemJson.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)) {
+                        zhishuiList.add(info.getLong("oid"));
+                    }
+                    if (!Check.isNull(itemCheck)) {
+                        String ownership = itemCheck.getOwnership();
+                        if ("ruixuan".equals(ownership)) {
+                            ruixuanList.add(info.getLong("oid"));
+                        }
+                        if ("miaogousi".equals(ownership)) {
+                            mgsList.add(info.getLong("oid"));
+                        }
+                        if ("rocket".equals(ownership)) {
+                            rocketList.add(info.getLong("oid"));
+                        }
+                        if ("yufu".equals(ownership)) {
+                            yufuList.add(info.getLong("oid"));
+                        }
+                        if ("yuxiu".equals(ownership)) {
+                            yuxiuList.add(info.getLong("oid"));
+                        }
+                        if ("zhishui".equals(ownership)) {
+                            zhishuiList.add(info.getLong("oid"));
+                        }
+                    }
+                }
+            }
+        } else {
+            log.error("===zhishui查询分销团长订单列表(open.distribution.cps.leader.order.cursor.list)失败,信息:{}", obj.getString("error_msg"));
+            log.error("zhishui游标:{},执行次数:{}", pcursor, counts);
+            if (counts <= 3) {
+                getZhishuiInfo(accessToken, beginTime, endTime, url, pcursor, counts + 1);
+            }
+        }
+
+        if (!Check.isNull(zhishuiList)) {
+            supplyChainMapper.updateZhishuiKuaishouSupplyChain(zhishuiList);
+        }
+        if (!Check.isNull(yuxiuList)) {
+            supplyChainMapper.updateYuxiuKuaishouSupplyChain(yuxiuList);
+        }
+        if (!Check.isNull(ruixuanList)) {
+            supplyChainMapper.updateKuaishouSupplyChain(ruixuanList);
+        }
+        if (!Check.isNull(mgsList)) {
+            supplyChainMapper.updateMgsKuaishouSupplyChain(mgsList);
+        }
+        if (!Check.isNull(rocketList)) {
+            supplyChainMapper.updateRocketKuaishouSupplyChain(rocketList);
+        }
+        if (!Check.isNull(yufuList)) {
+            supplyChainMapper.updateYufuKuaishouSupplyChain(yufuList);
+        }
+        if (!"nomore".equals(pcursor)) {
+            getZhishuiInfo(accessToken, beginTime, endTime, url, pcursor, 1);
+        }
+    }
+
     private KuaishouSupplyChain organizeData(JSONObject jsonObject, Map<Long, Long> itemMap) {
     private KuaishouSupplyChain organizeData(JSONObject jsonObject, Map<Long, Long> itemMap) {
         KuaishouSupplyChain supplyChain = new KuaishouSupplyChain();
         KuaishouSupplyChain supplyChain = new KuaishouSupplyChain();
         supplyChain.setOid(jsonObject.getLong("oid"));
         supplyChain.setOid(jsonObject.getLong("oid"));
@@ -1409,6 +1613,12 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
         for (KuaishouAccessToken accessToken : yuxiutokens) {
         for (KuaishouAccessToken accessToken : yuxiutokens) {
             getYuxiuInfoKuaishouActivityInfo(accessToken, url);
             getYuxiuInfoKuaishouActivityInfo(accessToken, url);
         }
         }
+
+        Thread.sleep(3000);
+        List<KuaishouAccessToken> zhishuitokens = accessTokenService.getZhishuiTokenInfos();
+        for (KuaishouAccessToken accessToken : zhishuitokens) {
+            getZhishuiInfoKuaishouActivityInfo(accessToken, url);
+        }
     }
     }
 
 
     @Override
     @Override
@@ -1458,6 +1668,15 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
             }
             }
         }
         }
 
 
+        Thread.sleep(30000);
+        List<Long> zhishuiActivityIds = supplyChainMapper.getZhishuiKuaishouActivityInfoList();
+        List<KuaishouAccessToken> zhishuitokens = accessTokenService.getZhishuiTokenInfos();
+        for (KuaishouAccessToken accessToken : zhishuitokens) {
+            for (Long activityId : zhishuiActivityIds) {
+                getKuaishouActivityOpenItemList(accessToken, url, activityId, 1, "zhishui");
+            }
+        }
+
     }
     }
 
 
     @Override
     @Override
@@ -1636,6 +1855,8 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
                     supplyChainMapper.replaceYufuKuaiShouActivityOpenItemList(list);
                     supplyChainMapper.replaceYufuKuaiShouActivityOpenItemList(list);
                 } else if ("yuxiu".equals(dbtype)) {
                 } else if ("yuxiu".equals(dbtype)) {
                     supplyChainMapper.replaceYuxiuKuaiShouActivityOpenItemList(list);
                     supplyChainMapper.replaceYuxiuKuaiShouActivityOpenItemList(list);
+                } else if ("zhishui".equals(dbtype)) {
+                    supplyChainMapper.replaceZhishuiKuaiShouActivityOpenItemList(list);
                 }
                 }
             }
             }
 
 
@@ -1704,6 +1925,10 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
                     for (KuaiShouActivityOpenItemList kuaiShouActivityOpenItemList : list) {
                     for (KuaiShouActivityOpenItemList kuaiShouActivityOpenItemList : list) {
                         supplyChainMapper.updateYuxiuKuaiShouActivityOpenItemList(kuaiShouActivityOpenItemList);
                         supplyChainMapper.updateYuxiuKuaiShouActivityOpenItemList(kuaiShouActivityOpenItemList);
                     }
                     }
+                } else if ("zhishui".equals(dbtype)) {
+                    for (KuaiShouActivityOpenItemList kuaiShouActivityOpenItemList : list) {
+                        supplyChainMapper.updateZhishuiKuaiShouActivityOpenItemList(kuaiShouActivityOpenItemList);
+                    }
                 }
                 }
             }
             }
         } else {
         } else {
@@ -1895,5 +2120,46 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
             supplyChainMapper.replaceYuxiuKuaishouActivityInfo(list);
             supplyChainMapper.replaceYuxiuKuaishouActivityInfo(list);
         }
         }
     }
     }
+
+    private void getZhishuiInfoKuaishouActivityInfo(KuaishouAccessToken accessToken, String url) {
+        List<KuaiShouActivityInfo> list = new ArrayList<>();
+        String appKey = accessToken.getAppKey();
+        String signSecret = accessToken.getSignSecret();
+        if (Check.isNull(signSecret) || Check.isNull(appKey)) {
+            return;
+        }
+        AccessTokenKsMerchantClient client = new AccessTokenKsMerchantClient(url, appKey, signSecret);
+        OpenDistributionInvestmentActivityOpenListRequest request = new OpenDistributionInvestmentActivityOpenListRequest();
+
+        request.setAccessToken(accessToken.getAccessToken());
+        request.setApiMethodVersion(1L);
+
+        //每页活动数量
+        request.setLimit(200);
+        OpenDistributionInvestmentActivityOpenListResponse response = null;
+        try {
+            response = client.execute(request);
+        } catch (KsMerchantApiException e) {
+            e.printStackTrace();
+        }
+        JSONObject obj = JSONObject.parseObject(GsonUtils.toJSON(response));
+        String code = obj.getString("code");
+        if ("1".equals(code)) {
+            JSONObject data = obj.getJSONObject("data");
+            JSONArray result = data.getJSONArray("result");
+            for (int i = 0; i < result.size(); i++) {
+                JSONObject info = result.getJSONObject(i);
+                KuaiShouActivityInfo activityInfo = organizeKuaishouActivityInfo(info);
+                list.add(activityInfo);
+            }
+        } else {
+            log.error("===zhishui团长查询招商活动列表(open.distribution.investment.activity.open.list)失败,信息:{}", obj.getString("msg"));
+            return;
+        }
+
+        if (Check.isNotNull(list) && list.size() > 0) {
+            supplyChainMapper.replaceZhishuiKuaishouActivityInfo(list);
+        }
+    }
 }
 }
 
 

+ 5 - 0
ruixuan-live/src/main/resources/mapper/isc/AccessTokenMapper.xml

@@ -69,6 +69,11 @@
         from yuxiu.kuaishou_access_token
         from yuxiu.kuaishou_access_token
     </select>
     </select>
 
 
+    <select id="getZhishuiTokenInfos" resultType="com.ruixuan.isc.entity.KuaishouAccessToken">
+        select *
+        from zhishui.kuaishou_access_token
+    </select>
+
     <select id="getRocketTokenInfos" resultType="com.ruixuan.isc.entity.KuaishouAccessToken">
     <select id="getRocketTokenInfos" resultType="com.ruixuan.isc.entity.KuaishouAccessToken">
         select *
         select *
         from rocket.kuaishou_access_token
         from rocket.kuaishou_access_token

+ 25 - 2
ruixuan-live/src/main/resources/mapper/isc/JiaoYangCallbackMapper.xml

@@ -279,6 +279,9 @@
               union all
               union all
               select item_id as 'itemId', 'yuxiu' as 'ownershipId'
               select item_id as 'itemId', 'yuxiu' as 'ownershipId'
               from yuxiu.kuaishou_item_list
               from yuxiu.kuaishou_item_list
+              union all
+              select item_id as 'itemId', 'zhishui' as 'ownershipId'
+              from zhishui.kuaishou_item_list
              ) t
              ) t
         group by t.itemId
         group by t.itemId
     </select>
     </select>
@@ -961,8 +964,9 @@
             )
             )
         </foreach>
         </foreach>
     </insert>
     </insert>
-    <insert id="insertYuXiuItem" parameterType="com.ruixuan.isc.entity.KuaishouItemList">
-        insert into yuxiu.kuaishou_item_list
+
+    <insert id="insertZhishuiItem" parameterType="com.ruixuan.isc.entity.KuaishouItemList">
+        insert into zhishui.kuaishou_item_list
         <trim prefix="(" suffix=")" suffixOverrides=",">
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="itemId != null">item_id,</if>
             <if test="itemId != null">item_id,</if>
             <if test="mediaId != null">media_id,</if>
             <if test="mediaId != null">media_id,</if>
@@ -1076,6 +1080,25 @@
     </insert>
     </insert>
 
 
 
 
+    <insert id="batchZhishuiCategory">
+        replace into zhishui.kuaishou_item_category(
+        category_id,
+        category_name,
+        parent_id,
+        category_sort
+        )
+        values
+        <foreach collection="adds" item="add" separator=",">
+            (
+            #{add.categoryId},
+            #{add.categoryName},
+            #{add.parentId},
+            #{add.categorySort}
+            )
+        </foreach>
+    </insert>
+
+
     <update id="updateKuaishouItemList" parameterType="com.ruixuan.isc.entity.KuaishouItemList">
     <update id="updateKuaishouItemList" parameterType="com.ruixuan.isc.entity.KuaishouItemList">
         update kuaishou_item_list
         update kuaishou_item_list
         <trim prefix="SET" suffixOverrides=",">
         <trim prefix="SET" suffixOverrides=",">

+ 59 - 0
ruixuan-live/src/main/resources/mapper/isc/KuaishouPromoterMapper.xml

@@ -907,6 +907,34 @@
     </select>
     </select>
 
 
 
 
+    <select id="getZhishuiFailInfo" resultType="com.ruixuan.isc.entity.JYKuaishouPromoter">
+        select id,
+               media_id,
+               user_id,
+               user_name,
+               promoter_id,
+               promoter_nick_name,
+               `state`,
+               province,
+               commission_requirement,
+               category_requirement,
+               promoter_url,
+               phone,
+               consignee,
+               promoter_address,
+               total_sale,
+               fans_number,
+               avg_video_sales,
+               video_sales,
+               create_time,
+               update_time
+        from zhishui.kuaishou_promoter
+        where (promoter_nick_name = '' or promoter_nick_name is null)
+          AND state = 1
+          AND media_id = 2
+    </select>
+
+
     <update id="updateYufuKuaishouPromoterByPromoterId" parameterType="com.ruixuan.isc.entity.KuaishouPromoter">
     <update id="updateYufuKuaishouPromoterByPromoterId" parameterType="com.ruixuan.isc.entity.KuaishouPromoter">
         update yufu.kuaishou_promoter
         update yufu.kuaishou_promoter
         <trim prefix="SET" suffixOverrides=",">
         <trim prefix="SET" suffixOverrides=",">
@@ -970,6 +998,37 @@
         where promoter_id = #{promoterId}
         where promoter_id = #{promoterId}
     </update>
     </update>
 
 
+    <update id="updateZhishuiKuaishouPromoterByPromoterId" parameterType="com.ruixuan.isc.entity.KuaishouPromoter">
+        update zhishui.kuaishou_promoter
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="userId != null">user_id = #{userId},</if>
+            <if test="mediaId != null">media_id = #{mediaId},</if>
+            <if test="userName != null">user_name = #{userName},</if>
+            <if test="promoterId != null">promoter_id = #{promoterId},</if>
+            <if test="promoterNickName != null">promoter_nick_name = #{promoterNickName},</if>
+            <if test="totalSale != null">total_sale = #{totalSale},</if>
+            <if test="fansNumber != null">fans_number = #{fansNumber},</if>
+            <if test="promoterUrl != null">promoter_url = #{promoterUrl},</if>
+            <if test="phone != null">phone = #{phone},</if>
+            <if test="consignee != null">consignee = #{consignee},</if>
+            <if test="promoterAddress != null">promoter_address = #{promoterAddress},</if>
+            <if test="state != null">state = #{state},</if>
+            <if test="province != null">province = #{province},</if>
+            <if test="commissionRequirement != null">commission_requirement = #{commissionRequirement},</if>
+            <if test="categoryRequirement != null">category_requirement = #{categoryRequirement},</if>
+            <if test="avgVideoSales != null">avg_video_sales = #{avgVideoSales},</if>
+            <if test="videoSales != null">video_sales = #{videoSales},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="followerIncr != null">follower_incr = #{followerIncr},</if>
+            <if test="liveCount30 != null">live_count_30 = #{liveCount30},</if>
+            <if test="awemeAvgDiggCount30 != null">aweme_avg_digg_count_30 = #{awemeAvgDiggCount30},</if>
+            <if test="awemeDiggFollowerRation != null">aweme_digg_follower_ration = #{awemeDiggFollowerRation},</if>
+            <if test="liveAverageUser30 != null">live_average_user_30 = #{liveAverageUser30},</if>
+        </trim>
+        where promoter_id = #{promoterId}
+    </update>
+
 
 
     <delete id="deleteKuaishouPromoterByIds" parameterType="String">
     <delete id="deleteKuaishouPromoterByIds" parameterType="String">
         delete from kuaishou_promoter where id in
         delete from kuaishou_promoter where id in

+ 97 - 14
ruixuan-live/src/main/resources/mapper/isc/SupplyChainMapper.xml

@@ -3103,6 +3103,36 @@
         </foreach>
         </foreach>
     </insert>
     </insert>
 
 
+    <insert id="replaceZhishuiKuaishouActivityInfo">
+        replace into zhishui.kuaishou_activity_info(
+        activity_id,
+        regimental_id,
+        activity_title,
+        activity_type,
+        activity_begin_time,
+        activity_end_time,
+        activity_status,
+        apply_item_count,
+        wait_audit_item_count,
+        audit_pass_item_count
+        )
+        values
+        <foreach collection="list" item="add" separator=",">
+            (
+            #{add.activityId},
+            #{add.regimentalId},
+            #{add.activityTitle},
+            #{add.activityType},
+            #{add.activityBeginTime},
+            #{add.activityEndTime},
+            #{add.activityStatus},
+            #{add.applyItemCount},
+            #{add.waitAuditItemCount},
+            #{add.auditPassItemCount}
+            )
+        </foreach>
+    </insert>
+
     <update id="updateKuaishouSupplyChain">
     <update id="updateKuaishouSupplyChain">
         update ruixuan.kuaishou_supply_chain set send_status = 1
         update ruixuan.kuaishou_supply_chain set send_status = 1
         where oid in
         where oid in
@@ -3148,6 +3178,15 @@
         </foreach>
         </foreach>
     </update>
     </update>
 
 
+    <update id="updateZhishuiKuaishouSupplyChain">
+        update zhishui.kuaishou_supply_chain set send_status = 1
+        where oid in
+        <foreach collection="list" item="id" separator=","
+                 open="(" close=")">
+            #{id}
+        </foreach>
+    </update>
+
     <update id="updateRuiXuanOrderRegimentalSettleAmount">
     <update id="updateRuiXuanOrderRegimentalSettleAmount">
         UPDATE ruixuan.kuaishou_supply_chain
         UPDATE ruixuan.kuaishou_supply_chain
         SET order_status                   = #{cpsOrderStatus},
         SET order_status                   = #{cpsOrderStatus},
@@ -3181,6 +3220,14 @@
             total_regimental_settle_amount = regimental_promotion_amount
             total_regimental_settle_amount = regimental_promotion_amount
         WHERE oid = #{oid}
         WHERE oid = #{oid}
     </update>
     </update>
+
+    <update id="updateZhishuiOrderRegimentalSettleAmount">
+        UPDATE zhishui.kuaishou_supply_chain
+        SET order_status                   = #{cpsOrderStatus},
+            total_regimental_settle_amount = regimental_promotion_amount
+        WHERE oid = #{oid}
+    </update>
+
     <update id="updateRuixuanOrder">
     <update id="updateRuixuanOrder">
         UPDATE ruixuan.kuaishou_supply_chain
         UPDATE ruixuan.kuaishou_supply_chain
         SET order_status = #{cpsOrderStatus}
         SET order_status = #{cpsOrderStatus}
@@ -3204,12 +3251,18 @@
         WHERE oid = #{oid}
         WHERE oid = #{oid}
     </update>
     </update>
 
 
-    <update id="updateYuxiuOrder">
+    <update id="updateYuXiuOrder">
         UPDATE yuxiu.kuaishou_supply_chain
         UPDATE yuxiu.kuaishou_supply_chain
         SET order_status = #{cpsOrderStatus}
         SET order_status = #{cpsOrderStatus}
         WHERE oid = #{oid}
         WHERE oid = #{oid}
     </update>
     </update>
 
 
+    <update id="updateZhishuiOrder">
+        UPDATE zhishui.kuaishou_supply_chain
+        SET order_status = #{cpsOrderStatus}
+        WHERE oid = #{oid}
+    </update>
+
     <select id="getBytedanceOrderHourDataList" resultType="com.alibaba.fastjson.JSONObject">
     <select id="getBytedanceOrderHourDataList" resultType="com.alibaba.fastjson.JSONObject">
         SELECT pay_success_time_hour AS 'hour', IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN 1 ELSE 0 END), 0) AS 'validOrderNum', IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN total_pay_amount ELSE 0 END), 0) AS 'baseAmount'
         SELECT pay_success_time_hour AS 'hour', IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN 1 ELSE 0 END), 0) AS 'validOrderNum', IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN total_pay_amount ELSE 0 END), 0) AS 'baseAmount'
         FROM bytedance_order_list
         FROM bytedance_order_list
@@ -3713,7 +3766,6 @@
         </foreach>
         </foreach>
     </insert>
     </insert>
 
 
-
     <insert id="replaceYuxiuKuaiShouActivityOpenItemList">
     <insert id="replaceYuxiuKuaiShouActivityOpenItemList">
         replace into yuxiu.kuaishou_activity_open_item_list(
         replace into yuxiu.kuaishou_activity_open_item_list(
         item_id,
         item_id,
@@ -3738,6 +3790,29 @@
         </foreach>
         </foreach>
     </insert>
     </insert>
 
 
+    <insert id="replaceZhishuiKuaiShouActivityOpenItemList">
+        replace into zhishui.kuaishou_activity_open_item_list(
+        item_id,
+        item_category_name,
+        item_price,
+        pre_activity_id,
+        item_leaf_category_id,
+        item_commission_rate,
+        investment_promotion_rate
+        )
+        values
+        <foreach collection="list" item="li" separator=",">
+            (
+            #{li.itemId},
+            #{li.itemCategoryName},
+            #{li.itemPrice},
+            #{li.preActivityId},
+            #{li.itemLeafCategoryId},
+            #{li.itemCommissionRate},
+            #{li.investmentPromotionRate}
+            )
+        </foreach>
+    </insert>
 
 
     <select id="getKuaishouActivityInfoList" resultType="Long">
     <select id="getKuaishouActivityInfoList" resultType="Long">
         SELECT DISTINCT activity_id
         SELECT DISTINCT activity_id
@@ -3774,6 +3849,13 @@
            OR activity_status = 3
            OR activity_status = 3
     </select>
     </select>
 
 
+    <select id="getZhishuiKuaishouActivityInfoList" resultType="Long">
+        SELECT DISTINCT activity_id
+        FROM zhishui.kuaishou_activity_info
+        WHERE activity_status = 2
+           OR activity_status = 3
+    </select>
+
     <select id="getPromoterId" resultType="com.alibaba.fastjson.JSONObject" parameterType="java.lang.Long">
     <select id="getPromoterId" resultType="com.alibaba.fastjson.JSONObject" parameterType="java.lang.Long">
         SELECT tag, proportion
         SELECT tag, proportion
         FROM promoter_tag
         FROM promoter_tag
@@ -3969,18 +4051,6 @@
             store_score          = #{storeScore}
             store_score          = #{storeScore}
         where item_id = #{itemId}
         where item_id = #{itemId}
     </update>
     </update>
-    <update id="updateYuXiuOrder">
-        UPDATE yuxiu.kuaishou_supply_chain
-        SET order_status = #{cpsOrderStatus}
-        WHERE oid = #{oid}
-    </update>
-    <update id="updateYuXiuOrderRegimentalSettleAmount">
-        UPDATE yuxiu.kuaishou_supply_chain
-        SET order_status                   = #{cpsOrderStatus},
-            total_regimental_settle_amount = regimental_promotion_amount
-        WHERE oid = #{oid}
-
-    </update>
 
 
     <update id="updateYuxiuKuaiShouActivityOpenItemList">
     <update id="updateYuxiuKuaiShouActivityOpenItemList">
         UPDATE yuxiu.kuaishou_activity_open_item_list
         UPDATE yuxiu.kuaishou_activity_open_item_list
@@ -4006,4 +4076,17 @@
         WHERE oid = #{oid}
         WHERE oid = #{oid}
     </update>
     </update>
 
 
+    <update id="updateZhishuiKuaiShouActivityOpenItemList">
+        UPDATE zhishui.kuaishou_activity_open_item_list
+        SET shop_star            = #{shopStar},
+            mall_logistics_score = #{mallLogisticsScore},
+            shop_score           = #{shopScore},
+            mall_service_score   = #{mallServiceScore},
+            mall_quality_score   = #{mallQualityScore},
+            base_order_status    = #{baseOrderStatus},
+            ccr_value            = #{ccrValue},
+            store_score          = #{storeScore}
+        where item_id = #{itemId}
+    </update>
+
 </mapper>
 </mapper>