Explorar o código

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	ruixuan-live/src/main/java/com/ruixuan/isc/entity/KuaishouRewardBaseInfo.java
#	ruixuan-live/src/main/java/com/ruixuan/isc/mapper/KuaishouRewardBaseInfoMapper.java
#	ruixuan-live/src/main/java/com/ruixuan/isc/service/IKuaishouRewardBaseInfoService.java
#	ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouRewardBaseInfoServiceImpl.java
#	ruixuan-live/src/main/resources/mapper/isc/KuaishouRewardBaseInfoMapper.xml
yumeng hai 7 meses
pai
achega
d381a77bfe

+ 43 - 12
ruixuan-live/src/main/java/com/ruixuan/isc/controller/SupplyChainController.java

@@ -4,11 +4,13 @@ import com.alibaba.fastjson.JSONObject;
 import com.kuaishou.merchant.open.api.KsMerchantApiException;
 import com.kuaishou.merchant.open.api.common.utils.PlatformEventSecurityUtil;
 import com.ruixuan.common.core.controller.BaseController;
+import com.ruixuan.common.core.domain.ResultResponse;
 import com.ruixuan.common.core.page.TableDataInfo;
 import com.ruixuan.common.utils.Check;
 import com.ruixuan.common.utils.DateUtils;
 import com.ruixuan.data.utils.ExportExcelUtils;
 import com.ruixuan.isc.service.IKuaishouPromoterService;
+import com.ruixuan.isc.service.IKuaishouRewardBaseInfoService;
 import com.ruixuan.isc.service.IKwaixiaodianOrderCursorListService;
 import com.ruixuan.isc.service.ISupplyChainService;
 import com.ruixuan.system.service.ISysDeptService;
@@ -26,6 +28,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -55,6 +58,9 @@ public class SupplyChainController extends BaseController {
     @Autowired
     private IKuaishouPromoterService promoterService;
 
+    @Autowired
+    private IKuaishouRewardBaseInfoService kuaishouRewardBaseInfoService;
+
     @Value("${accept.ruiXuanPrivateKey}")
     private String ruiXuanPrivateKey;
     @Value("${accept.rocketPrivateKey}")
@@ -2139,12 +2145,18 @@ public class SupplyChainController extends BaseController {
      */
     @GetMapping("/insertOrderList")
     @ApiOperation(value = "新增分销团长订单列表(游标方式)")
-    public void insertOrderList(Integer queryType, String beginDate, String endDate) {
-        try {
-            supplyChainService.insertOrderList(queryType, beginDate, endDate);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
+    public void insertOrderList(Long tokenId, Integer queryType, String beginDate, String endDate) {
+        Thread thread = new Thread() {
+            @Override
+            public void run() {
+                try {
+                    supplyChainService.insertOrderList(tokenId, queryType, beginDate, endDate);
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+        };
+        thread.start();
     }
 
     /**
@@ -2155,12 +2167,18 @@ public class SupplyChainController extends BaseController {
      */
     @GetMapping("/insertNowdayOrderList")
     @ApiOperation(value = "新增当天分销团长订单列表(游标方式)")
-    public void insertNowdayOrderList() {
-        try {
-            supplyChainService.insertNowdayOrderList();
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
+    public void insertNowdayOrderList(Long tokenId) {
+        Thread thread = new Thread() {
+            @Override
+            public void run() {
+                try {
+                    supplyChainService.insertNowdayOrderList(tokenId);
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+        };
+        thread.start();
     }
 
     static ExecutorService fxNowService = Executors.newFixedThreadPool(10);
@@ -2766,4 +2784,17 @@ public class SupplyChainController extends BaseController {
         }
     }
 
+    /**
+     * 通过excel导入RewardBaseInfo
+     */
+    @PostMapping(value = "/insertRewardBaseInfoByExcel")
+    @ApiOperation(value = "导入rewardBaseInfo")
+    public ResultResponse insertRewardBaseInfoByExcel(@ApiParam("excel文档") @RequestParam(value = "file", required = false) MultipartFile file) {
+        try {
+            return kuaishouRewardBaseInfoService.insertRewardBaseInfoByExcel(file);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return ResultResponse.error("导入异常");
+        }
+    }
 }

+ 15 - 1
ruixuan-live/src/main/java/com/ruixuan/isc/entity/KuaishouRewardBaseInfo.java

@@ -244,5 +244,19 @@ public class KuaishouRewardBaseInfo extends BaseEntity {
                 ", itemCreateName='" + itemCreateName + '\'' +
                 '}';
     }
-}
 
+
+
+    public KuaishouRewardBaseInfo(JSONObject obj) {
+        this.setPromoterId(obj.getLong("0"));//达人ID
+        this.setPromoterName(obj.getString("1"));//达人昵称
+        this.setItemId(obj.getLong("2"));//商品id
+        this.setItemTitle(obj.getString("3"));//商品名称
+        this.setTotalSettlementNum(obj.getLong("4"));//订单总量
+        this.setCurrentSettlementNum(obj.getLong("5"));//已结单量
+        this.setCurrentSettlementNum(obj.getLong("6"));//应结单量
+        this.setSettlementPrice(obj.getBigDecimal("7"));//结算单价
+        this.setAnchorAmount(obj.getBigDecimal("8"));//奖励
+        this.setStatDate(obj.getString("9"));//日期
+    }
+}

+ 8 - 4
ruixuan-live/src/main/java/com/ruixuan/isc/entity/KuaishouSupplyChain.java

@@ -150,7 +150,7 @@ public class KuaishouSupplyChain {
      */
     @Excel(name = "分成比例", width = 15)
     @ApiModelProperty(value = "分成比例")
-    private Long shareRate;
+    private String shareRate;
     /**
      * 货款基数
      */
@@ -280,7 +280,9 @@ public class KuaishouSupplyChain {
         this.setOrderAmount(info.getLong("orderTradeAmount"));
         this.setPayAmount(info.getLong("payAmount"));
         this.setRegimentalPromotionRate(info.getLong("regimentalPromotionRate"));
-        this.setShareRate(info.getLong("shareRateStr"));
+        if (!info.getString("shareRateStr").contains("正在计算中")) {
+            this.setShareRate(info.getString("shareRateStr"));
+        }
         this.setBaseAmount(info.getLong("baseAmount"));
         this.setServiceAmount(info.getLong("serviceAmount"));
         this.setRegimentalPromotionAmount(info.getLong("regimentalPromotionAmount"));
@@ -294,7 +296,7 @@ public class KuaishouSupplyChain {
         this.setPromoterCommissionRate(info.getLong("promoterCommissionRate"));
     }
 
-    public KuaishouSupplyChain(JSONObject info,String type) {
+    public KuaishouSupplyChain(JSONObject info, String type) {
         this.setOid(info.getLong("oid"));
         this.setRegimentalId(info.getLong("activityUserId"));
         this.setActivityId(info.getLong("activityId"));
@@ -328,7 +330,9 @@ public class KuaishouSupplyChain {
         this.setExpendEstimateSettleAmount(info.getLong("expendEstimateSettleAmount"));
         this.setExpendRegimentalPromotionRate(info.getLong("expendRegimentalPromotionRate"));
         this.setBaseAmount(info.getLong("baseAmount"));
-        this.setShareRate(info.getLong("shareRateStr"));
+        if (!info.getString("shareRateStr").contains("正在计算中")) {
+            this.setShareRate(info.getString("shareRateStr"));
+        }
         this.setExcitationIncome(info.getLong("excitationInCome"));
         this.setServiceIncome(info.getLong("serviceIncome"));
         this.setSettlementBizType(info.getInteger("settlementBizType"));

+ 3 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/mapper/KuaishouRewardBaseInfoMapper.java

@@ -70,4 +70,7 @@ public interface KuaishouRewardBaseInfoMapper {
     String getPromoterName(@Param("promoterId") String promoterId);
 
     JSONObject getTotal(KuaishouRewardBaseInfo kuaishouRewardBaseInfo);
+
+    void replaceBatchRewardBaseInfo(@Param("infoList") List<KuaishouRewardBaseInfo> infoList);
 }
+

+ 3 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/service/IKuaishouRewardBaseInfoService.java

@@ -66,4 +66,7 @@ public interface IKuaishouRewardBaseInfoService {
     JSONObject getInfo(Long itemId,String promoterId);
 
    JSONObject getTotal(KuaishouRewardBaseInfo kuaishouRewardBaseInfo);
+
+
+    ResultResponse insertRewardBaseInfoByExcel(MultipartFile file) throws Exception;
 }

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

@@ -180,9 +180,9 @@ public interface ISupplyChainService {
      */
     void addList(String beginDate, String endDate, String pcursor) throws InterruptedException;
 
-    void insertOrderList(Integer queryType, String beginDate, String endDate) throws Exception;
+    void insertOrderList(Long tokenId,Integer queryType, String beginDate, String endDate) throws Exception;
 
-    void insertNowdayOrderList()throws Exception;
+    void insertNowdayOrderList(Long tokenId)throws Exception;
 
     /*
      *团长查询招商活动列表

+ 3 - 8
ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouItemListServiceImpl.java

@@ -54,10 +54,6 @@ public class KuaishouItemListServiceImpl implements IKuaishouItemListService {
     @Autowired
     private MongoTemplate mongoTemplate;
 
-
-    private static final String URL = "https://openapi.kwaixiaodian.com";
-
-
     @Override
     public List<KuaishouItemList> getItemList(Map<String, Object> requestMap) {
         List<KuaishouItemList> itemList = kuaishouItemListMapper.getItemList(requestMap);
@@ -262,7 +258,7 @@ public class KuaishouItemListServiceImpl implements IKuaishouItemListService {
 
     @Override
     public int addCategoryId(KuaishouAccessToken accessToken) throws KsMerchantApiException {
-        AccessTokenKsMerchantClient client = new AccessTokenKsMerchantClient(URL, accessToken.getAppKey(), accessToken.getSignSecret());
+        AccessTokenKsMerchantClient client = new AccessTokenKsMerchantClient(KuaiShouConstants.KFX_URL, accessToken.getAppKey(), accessToken.getSignSecret());
         OpenDistributionPublicCategoryListRequest request = new OpenDistributionPublicCategoryListRequest();
         request.setAccessToken(accessToken.getAccessToken());
         request.setApiMethodVersion(1L);
@@ -429,8 +425,7 @@ public class KuaishouItemListServiceImpl implements IKuaishouItemListService {
     @Override
     public JSONObject getInvalidItemList(Long activityId, Long itemId, KuaishouAccessToken accessToken) {
         JSONObject returnJson = new JSONObject();
-
-        AccessTokenKsMerchantClient client = new AccessTokenKsMerchantClient(URL, accessToken.getAppKey(), accessToken.getSignSecret());
+        AccessTokenKsMerchantClient client = new AccessTokenKsMerchantClient(KuaiShouConstants.KFX_URL, accessToken.getAppKey(), accessToken.getSignSecret());
         OpenDistributionInvestmentActivityInvalidItemListRequest request = new OpenDistributionInvestmentActivityInvalidItemListRequest();
         request.setAccessToken(accessToken.getAccessToken());
         request.setApiMethodVersion(1L);
@@ -461,7 +456,7 @@ public class KuaishouItemListServiceImpl implements IKuaishouItemListService {
     @Override
     public JSONObject getInvestmentActivityOpenItemList(Long activityId, Long itemId, KuaishouAccessToken accessToken) {
         JSONObject returnJson = new JSONObject();
-        AccessTokenKsMerchantClient client = new AccessTokenKsMerchantClient(URL, accessToken.getAppKey(), accessToken.getSignSecret());
+        AccessTokenKsMerchantClient client = new AccessTokenKsMerchantClient(KuaiShouConstants.KFX_URL, accessToken.getAppKey(), accessToken.getSignSecret());
 
         OpenDistributionInvestmentActivityOpenItemListRequest request = new OpenDistributionInvestmentActivityOpenItemListRequest();
         request.setAccessToken(accessToken.getAccessToken());

+ 33 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouRewardBaseInfoServiceImpl.java

@@ -5,6 +5,10 @@ import java.util.List;
 
 import com.alibaba.fastjson.JSONObject;
 import com.ruixuan.common.utils.DateUtils;
+import com.alibaba.fastjson.JSONObject;
+import com.ruixuan.common.core.domain.ResultResponse;
+import com.ruixuan.common.utils.Check;
+import com.ruixuan.data.utils.LiveDataExcelUtils;
 import com.ruixuan.isc.entity.KuaishouRewardBaseInfo;
 import com.ruixuan.isc.mapper.KuaishouRewardBaseInfoMapper;
 import com.ruixuan.isc.service.IKuaishouRewardBaseInfoService;
@@ -18,6 +22,12 @@ import org.springframework.stereotype.Service;
  * @author ruoyi
  * @date 2024-10-31
  */
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
 @Service
 public class KuaishouRewardBaseInfoServiceImpl implements IKuaishouRewardBaseInfoService {
     @Autowired
@@ -111,3 +121,26 @@ public class KuaishouRewardBaseInfoServiceImpl implements IKuaishouRewardBaseInf
         return kuaishouRewardBaseInfoMapper.getTotal(kuaishouRewardBaseInfo);
     }
 }
+
+    @Override
+    public ResultResponse insertRewardBaseInfoByExcel(MultipartFile file) throws Exception {
+        String fileName = file.getOriginalFilename();
+        List<JSONObject> list = LiveDataExcelUtils.analysisFile(file, fileName);
+        if (!Check.isNull(list)) {
+            List<KuaishouRewardBaseInfo> infoList = new ArrayList<>();
+            for (JSONObject o : list) {
+                if ("达人ID".equals(o.getString("0"))) {
+                    continue;
+                }
+                KuaishouRewardBaseInfo baseInfo = new KuaishouRewardBaseInfo(o);
+                infoList.add(baseInfo);
+            }
+
+            if (!Check.isNull(infoList)) {
+                kuaishouRewardBaseInfoMapper.replaceBatchRewardBaseInfo(infoList);
+            }
+        }
+        return ResultResponse.success();
+    }
+}
+

+ 43 - 123
ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/SupplyChainServiceImpl.java

@@ -16,6 +16,7 @@ import com.kuaishou.merchant.open.api.response.distribution.OpenDistributionInve
 import com.kuaishou.merchant.open.api.response.distribution.OpenDistributionInvestmentActivityOpenListResponse;
 import com.ruixuan.common.utils.Check;
 import com.ruixuan.common.utils.DateUtils;
+import com.ruixuan.isc.constants.KuaiShouConstants;
 import com.ruixuan.isc.entity.ItemCheck;
 import com.ruixuan.isc.entity.KuaiShouActivityInfo;
 import com.ruixuan.isc.entity.KuaiShouActivityOpenItemList;
@@ -37,8 +38,6 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
 
 @Slf4j
 @Service
@@ -837,7 +836,7 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
 
     @Override
     public void addList(String beginDate, String endDate, String pcursor) throws InterruptedException {
-        String url = "https://openapi.kwaixiaodian.com";
+        String url = KuaiShouConstants.KFX_URL;
         Long beginTime = DateUtils.getStartLongTime(beginDate);
         Long endTime = DateUtils.getEndLongTime(endDate);
 //        Map<Long, Long> itemMap = getItemMap();
@@ -877,59 +876,12 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
 
     }
 
-    static ExecutorService ruixuanService = Executors.newFixedThreadPool(6);
-    static ExecutorService miaogousiService = Executors.newFixedThreadPool(3);
-    static ExecutorService rocketService = Executors.newFixedThreadPool(3);
-    static ExecutorService yufuService = Executors.newFixedThreadPool(3);
-    static ExecutorService yuxiuService = Executors.newFixedThreadPool(3);
-    static ExecutorService zhishuiService = Executors.newFixedThreadPool(3);
-
     @Override
-    public void insertOrderList(Integer queryType, String beginDate, String endDate) throws Exception {
-        String url = "https://openapi.kwaixiaodian.com";
+    public void insertOrderList(Long tokenId, Integer queryType, String beginDate, String endDate) throws Exception {
         Long beginTime = DateUtils.getStartLongTime(beginDate);
         Long endTime = DateUtils.getEndLongTime(endDate);
-
-        /* List<KuaishouAccessToken> tokens = accessTokenService.getTokenInfos();
-        tokens.forEach(token -> ruixuanService.submit(() -> {
-            insertRuixuanOrderList(queryType, token, beginTime, endTime, url, "", 1);
-        }));
-        //秒构思
-        Thread.sleep(3000);
-        List<KuaishouAccessToken> mgsTokens = accessTokenService.getMgsTokenInfos();
-        mgsTokens.forEach(token -> miaogousiService.submit(() -> {
-            insertRuixuanOrderList(queryType, token, beginTime, endTime, url, "", 1);
-        }));
-        */
-        //TODO 测完放开
-        //王炸
-        Thread.sleep(3000);
-        List<KuaishouAccessToken> rocketTokens = accessTokenService.getRocketTokenInfos();
-        rocketTokens.forEach(token -> rocketService.submit(() -> {
-            insertRuixuanOrderList(queryType, token, beginTime, endTime, url, "", 1);
-        }));
-        //TODO 测完放开
-       /*//预付
-        Thread.sleep(3000);
-        List<KuaishouAccessToken> yufuTokens = accessTokenService.getYufuTokenInfos();
-        yufuTokens.forEach(token -> yufuService.submit(() -> {
-            insertRuixuanOrderList(queryType, token, beginTime, endTime, url, "", 1);
-        }));
-
-        //毓秀
-        Thread.sleep(3000);
-        List<KuaishouAccessToken> yuxiuTokens = accessTokenService.getYuxiuTokenInfos();
-        yuxiuTokens.forEach(token -> yuxiuService.submit(() -> {
-            insertRuixuanOrderList(queryType, token, beginTime, endTime, url, "", 1);
-        }));
-
-        //止水
-        Thread.sleep(3000);
-        List<KuaishouAccessToken> zhishuiTokens = accessTokenService.getZhishuiTokenInfos();
-        zhishuiTokens.forEach(token -> zhishuiService.submit(() -> {
-            insertRuixuanOrderList(queryType, token, beginTime, endTime, url, "", 1);
-        }));*/
-
+        KuaishouAccessToken token = accessTokenService.getAccessToken(tokenId);
+        insertRuixuanOrderList(queryType, token, beginTime, endTime, KuaiShouConstants.KFX_URL, "", 1);
     }
 
     public static void main(String[] args) {
@@ -941,56 +893,18 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
     }
 
     @Override
-    public void insertNowdayOrderList() throws Exception {
-        String url = "https://openapi.kwaixiaodian.com";
+    public void insertNowdayOrderList(Long tokenId) throws Exception {
         //2小时前 时间戳
         Long beginTime = DateUtils.getTimeStamp(DateUtils.getHourTime(-2));
         //当前时间
         Long endTime = DateUtils.getTimeStamp(DateUtils.getTime());
-        /* List<KuaishouAccessToken> tokens = accessTokenService.getTokenInfos();
-        tokens.forEach(token -> ruixuanService.submit(() -> {
-            insertRuixuanOrderList(queryType, token, beginTime, endTime, url, "", 1);
-        }));
-        //秒构思
-        Thread.sleep(3000);
-        List<KuaishouAccessToken> mgsTokens = accessTokenService.getMgsTokenInfos();
-        mgsTokens.forEach(token -> miaogousiService.submit(() -> {
-            insertRuixuanOrderList(queryType, token, beginTime, endTime, url, "", 1);
-        }));
-        */
-        //TODO 测完放开
-        //王炸
-        Thread.sleep(3000);
-        List<KuaishouAccessToken> rocketTokens = accessTokenService.getRocketTokenInfos();
-        rocketTokens.forEach(token -> rocketService.submit(() -> {
-            insertRuixuanOrderList(1, token, beginTime, endTime, url, "", 1);
-        }));
-        //TODO 测完放开
-       /*//预付
-        Thread.sleep(3000);
-        List<KuaishouAccessToken> yufuTokens = accessTokenService.getYufuTokenInfos();
-        yufuTokens.forEach(token -> yufuService.submit(() -> {
-            insertRuixuanOrderList(queryType, token, beginTime, endTime, url, "", 1);
-        }));
-
-        //毓秀
-        Thread.sleep(3000);
-        List<KuaishouAccessToken> yuxiuTokens = accessTokenService.getYuxiuTokenInfos();
-        yuxiuTokens.forEach(token -> yuxiuService.submit(() -> {
-            insertRuixuanOrderList(queryType, token, beginTime, endTime, url, "", 1);
-        }));
-
-        //止水
-        Thread.sleep(3000);
-        List<KuaishouAccessToken> zhishuiTokens = accessTokenService.getZhishuiTokenInfos();
-        zhishuiTokens.forEach(token -> zhishuiService.submit(() -> {
-            insertRuixuanOrderList(queryType, token, beginTime, endTime, url, "", 1);
-        }));*/
-
+        KuaishouAccessToken token = accessTokenService.getAccessToken(tokenId);
+        insertRuixuanOrderList(1, token, beginTime, endTime, KuaiShouConstants.KFX_URL, "", 1);
     }
 
     private void insertRuixuanOrderList(Integer queryType, KuaishouAccessToken accessToken, Long beginTime, Long endTime, String url, String pcursor, int counts) {
         try {
+            List<KuaishouSupplyChain> commonlist = new ArrayList<>();
             List<KuaishouSupplyChain> ruixuanList = new ArrayList<>();
             List<KuaishouSupplyChain> mgsList = new ArrayList<>();
             List<KuaishouSupplyChain> rocketList = new ArrayList<>();
@@ -1037,32 +951,31 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
                     KuaishouSupplyChain supplyChain = new KuaishouSupplyChain(info, "1");
 
                     String ownership = null;
-                    Criteria criteria = new Criteria();
-                    criteria = Criteria.where("_id").is(supplyChain.getItemId());
-                    Query query = new Query(criteria);
-                    ItemCheck itemCheck = mongoTemplate.findOne(query, ItemCheck.class);
-                    if (!Check.isNull(itemCheck)) {
-                        ownership = itemCheck.getOwnership();
-                    }
-                    //TODO 放开下面代码
-                  /*  if (Check.isNull(ownership) || "ruixuan".equals(ownership)) {
-                        ruixuanList.add(supplyChain);
-                    }
-                    if ("miaogousi".equals(ownership)) {
-                        mgsList.add(supplyChain);
-                    }*/
-                    if ("rocket".equals(ownership)) {
-                        rocketList.add(supplyChain);
-                    }
-                    /*if ("yufu".equals(ownership)) {
-                        yufuList.add(supplyChain);
-                    }
-                    if ("yuxiu".equals(ownership)) {
-                        yuxiuList.add(supplyChain);
+//                    Criteria criteria = new Criteria();
+//                    criteria = Criteria.where("_id").is(supplyChain.getItemId());
+//                    Query query = new Query(criteria);
+//                    ItemCheck itemCheck = mongoTemplate.findOne(query, ItemCheck.class);
+//                    if (!Check.isNull(itemCheck)) {
+//                        ownership = itemCheck.getOwnership();
+//                    }
+
+                    if (Check.isNull(ownership)) {
+                        commonlist.add(supplyChain);
+                    } else {
+                        if ("ruixuan".equals(ownership)) {
+                            ruixuanList.add(supplyChain);
+                        } else if ("miaogousi".equals(ownership)) {
+                            mgsList.add(supplyChain);
+                        } else if ("rocket".equals(ownership)) {
+                            rocketList.add(supplyChain);
+                        } else if ("yufu".equals(ownership)) {
+                            yufuList.add(supplyChain);
+                        } else if ("yuxiu".equals(ownership)) {
+                            yuxiuList.add(supplyChain);
+                        } else if ("zhishui".equals(ownership)) {
+                            zhishuiList.add(supplyChain);
+                        }
                     }
-                    if ("zhishui".equals(ownership)) {
-                        zhishuiList.add(supplyChain);
-                    }*/
                 }
             } else {
                 log.error("===查询分销团长订单列表(open.distribution.cps.leader.order.cursor.list)失败,信息:{}", obj.getString("msg"));
@@ -1071,6 +984,10 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
                     insertRuixuanOrderList(queryType, accessToken, beginTime, endTime, url, pcursor, counts + 1);
                 }
             }
+            //入库操作
+            if (!Check.isNull(commonlist)) {
+                supplyChainMapper.replaceBatchOrder(null, commonlist);
+            }
             if (!Check.isNull(ruixuanList)) {
                 supplyChainMapper.replaceBatchOrder("ruixuan", ruixuanList); //TODO 测试完 修改该方法数据表
             }
@@ -1089,6 +1006,7 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
             if (!Check.isNull(zhishuiList)) {
                 supplyChainMapper.replaceBatchOrder("zhishui", zhishuiList);
             }
+
             if (!"nomore".equals(pcursor)) {
                 insertRuixuanOrderList(queryType, accessToken, beginTime, endTime, url, pcursor, 1);
             }
@@ -1793,7 +1711,9 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
         supplyChain.setOrderAmount(jsonObject.getLong("payAmount"));
         supplyChain.setPayAmount(jsonObject.getLong("payAmount"));
         supplyChain.setRegimentalPromotionRate(jsonObject.getLong("regimentalPromotionRate"));
-        supplyChain.setShareRate(jsonObject.getLong("shareRateStr"));
+        if (!jsonObject.getString("shareRateStr").contains("正在计算中")) {
+            supplyChain.setShareRate(jsonObject.getString("shareRateStr"));
+        }
         supplyChain.setBaseAmount(jsonObject.getLong("baseAmount"));
         supplyChain.setRegimentalPromotionAmount(jsonObject.getLong("regimentalPromotionAmount") / 1000);
         supplyChain.setTotalRegimentalSettleAmount(jsonObject.getLong("settlementAmount"));
@@ -1822,7 +1742,7 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
 
     @Override
     public void addListKuaishouActivityInfo() throws InterruptedException {
-        String url = "https://openapi.kwaixiaodian.com";
+        String url = KuaiShouConstants.KFX_URL;
         List<KuaishouAccessToken> mgsTokens = accessTokenService.getMgsTokenInfos();
         for (KuaishouAccessToken mgsToken : mgsTokens) {
             getMgsInfoKuaishouActivityInfo(mgsToken, url);
@@ -1858,7 +1778,7 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
 
     @Override
     public void addKuaishouActivityOpenItemList() throws InterruptedException {
-        String url = "https://openapi.kwaixiaodian.com";
+        String url = KuaiShouConstants.KFX_URL;
         List<Long> mgsActivityIds = supplyChainMapper.getMgsKuaishouActivityInfoList();
         List<KuaishouAccessToken> mgsTokens = accessTokenService.getMgsTokenInfos();
         for (KuaishouAccessToken mgsToken : mgsTokens) {

+ 2 - 2
ruixuan-live/src/main/java/com/ruixuan/open/service/impl/KuaishouOpenPhotoCountServiceImpl.java

@@ -6,6 +6,7 @@ import com.kuaishou.merchant.open.api.client.AccessTokenKsMerchantClient;
 import com.kuaishou.merchant.open.api.common.utils.GsonUtils;
 import com.kuaishou.merchant.open.api.request.video.OpenPhotoCountRequest;
 import com.kuaishou.merchant.open.api.response.video.OpenPhotoCountResponse;
+import com.ruixuan.isc.constants.KuaiShouConstants;
 import com.ruixuan.isc.entity.JYAccessToken;
 import com.ruixuan.isc.mapper.AccessTokenMapper;
 import com.ruixuan.open.entity.KuaishouOpenPhotoCount;
@@ -65,11 +66,10 @@ public class KuaishouOpenPhotoCountServiceImpl implements IKuaishouOpenPhotoCoun
 
     private void insertInfo(JYAccessToken token, String cursor) {
         try {
-            String url = "https://openapi.kwaixiaodian.com";
             String appKey = token.getAppKey();
             String signSecret = token.getSignSecret();
             String accessToken = token.getAccessToken();
-            AccessTokenKsMerchantClient client = new AccessTokenKsMerchantClient(url, appKey, signSecret);
+            AccessTokenKsMerchantClient client = new AccessTokenKsMerchantClient(KuaiShouConstants.KFX_URL, appKey, signSecret);
 
             OpenPhotoCountRequest request = new OpenPhotoCountRequest();
             request.setAccessToken(accessToken);

+ 2 - 3
ruixuan-live/src/main/java/com/ruixuan/open/service/impl/KuaishouOpenPhotoListServiceImpl.java

@@ -8,6 +8,7 @@ import com.kuaishou.merchant.open.api.request.video.OpenPhotoListRequest;
 import com.kuaishou.merchant.open.api.response.video.OpenPhotoListResponse;
 import com.ruixuan.common.utils.Check;
 import com.ruixuan.common.utils.DateUtils;
+import com.ruixuan.isc.constants.KuaiShouConstants;
 import com.ruixuan.isc.entity.JYAccessToken;
 import com.ruixuan.isc.mapper.AccessTokenMapper;
 import com.ruixuan.open.entity.KuaishouOpenPhotoList;
@@ -76,12 +77,10 @@ public class KuaishouOpenPhotoListServiceImpl implements IKuaishouOpenPhotoListS
 
     private void insertInfo(JYAccessToken token, String cursor) {
         try {
-            String url = "https://openapi.kwaixiaodian.com";
-
             String appKey = token.getAppKey();
             String signSecret = token.getSignSecret();
             String accessToken = token.getAccessToken();
-            AccessTokenKsMerchantClient client = new AccessTokenKsMerchantClient(url, appKey, signSecret);
+            AccessTokenKsMerchantClient client = new AccessTokenKsMerchantClient(KuaiShouConstants.KFX_URL, appKey, signSecret);
 
             OpenPhotoListRequest request = new OpenPhotoListRequest();
             request.setAccessToken(accessToken);

+ 2 - 2
ruixuan-live/src/main/java/com/ruixuan/open/service/impl/KuaishouOpenUserInfoServiceImpl.java

@@ -6,6 +6,7 @@ import com.kuaishou.merchant.open.api.client.AccessTokenKsMerchantClient;
 import com.kuaishou.merchant.open.api.common.utils.GsonUtils;
 import com.kuaishou.merchant.open.api.request.user.OpenUserInfoGetRequest;
 import com.kuaishou.merchant.open.api.response.user.OpenUserInfoGetResponse;
+import com.ruixuan.isc.constants.KuaiShouConstants;
 import com.ruixuan.isc.entity.JYAccessToken;
 import com.ruixuan.isc.mapper.AccessTokenMapper;
 import com.ruixuan.open.entity.KuaishouOpenUserInfo;
@@ -64,11 +65,10 @@ public class KuaishouOpenUserInfoServiceImpl implements IKuaishouOpenUserInfoSer
 
     private void insertInfo(JYAccessToken token, String cursor) {
         try {
-            String url = "https://openapi.kwaixiaodian.com";
             String appKey = token.getAppKey();
             String signSecret = token.getSignSecret();
             String accessToken = token.getAccessToken();
-            AccessTokenKsMerchantClient client = new AccessTokenKsMerchantClient(url, appKey, signSecret);
+            AccessTokenKsMerchantClient client = new AccessTokenKsMerchantClient(KuaiShouConstants.KFX_URL, appKey, signSecret);
 
             OpenUserInfoGetRequest request = new OpenUserInfoGetRequest();
             request.setAccessToken(accessToken);

+ 36 - 0
ruixuan-live/src/main/resources/mapper/isc/KuaishouRewardBaseInfoMapper.xml

@@ -203,4 +203,40 @@
             #{id}
         </foreach>
     </delete>
+    <insert id="replaceBatchRewardBaseInfo">
+        replace into
+        kuaishou_reward_base_info
+        (
+        item_id,
+        item_title,
+        promoter_id,
+        promoter_name,
+        stat_date,
+        current_settlement_num,
+        total_settlement_num,
+        settlement_price,
+        anchor_amount,
+        reference_amount,
+        total_amount,
+        remarks
+        )
+        values
+        <foreach collection="infoList" item="info" separator=",">
+            (
+            #{info.itemId},
+            #{info.itemTitle},
+            #{info.promoterId},
+            #{info.promoterName},
+            #{info.statDate},
+            #{info.currentSettlementNum},
+            #{info.totalSettlementNum},
+            #{info.settlementPrice},
+            #{info.anchorAmount},
+            #{info.referenceAmount},
+            #{info.totalAmount},
+            #{info.remarks}
+            )
+        </foreach>
+    </insert>
+
 </mapper>

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

@@ -4245,7 +4245,7 @@
         replace into
         <choose>
             <when test='ownership == null '>
-                ruixuan.kuaishou_supply_chain_ceshi
+                kuaishou_supply_chain_ceshi
             </when>
             <otherwise>
                 ${ownership}.kuaishou_supply_chain_ceshi