Browse Source

ccr数据获取

yumeng 1 year ago
parent
commit
8a394c947b

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

@@ -147,7 +147,7 @@ public class TestController {
     @Autowired
     private IRefreshTokenService refreshTokenService;
     @Autowired
-    private IMgsSupplyChainService ikuaishouSupplyChainService;
+    private IMgsSupplyChainService mgskuaishouSupplyChainService;
     @Autowired
     private IWechatCheckinDataService wechatCheckinDataService;
     @Autowired
@@ -157,33 +157,18 @@ public class TestController {
     @Autowired
     private IKuaiShouActivityItemListService activityItemListService;
 
-    @Autowired
-    private IJiaoYangFenXiaoService jiaoYangFenXiaoService;
 
-    @Autowired
-    private IKuaishouSupplyChainService kuaishouSupplyChainService;
 
 
-  /*  public static void main(String[] args) {
-        List<JSONObject> cookies = kuaishouSupplyChainService.getCookie();
-        if (Check.isNull(cookies)) {
-            return;
-        }
 
-        for (int i = 0; i < cookies.size(); i++) {
-            JSONObject jsonObject = cookies.get(i);
-            String cookie = jsonObject.getString("cookie");
-            kuaishouSupplyChainService.getRuiXuanCcrInfo(cookie, 100, "ruixuan");
 
-        }
-    }*/
 
 
     @GetMapping(value = "/getData")
     public void getDate(String startDate, String endDate) throws Exception {
 
         log.info("-------------------------获取快分销订单当前月数据开始数据开始--------------------------");
-        List<JSONObject> cookies = ikuaishouSupplyChainService.getCookie();
+        List<JSONObject> cookies = mgskuaishouSupplyChainService.getCookie();
         if (Check.isNull(cookies)) {
             log.error("cookie数据为空");
             return;
@@ -213,54 +198,7 @@ public class TestController {
                             @Override
                             public void run() {
                                 try {
-                                    ikuaishouSupplyChainService.getOrderList(cookie, 0, orderCreateTimeStart, orderCreateTimeEnd, itemMap);
-                                } catch (Exception e) {
-                                    e.printStackTrace();
-                                }
-                            }
-                        });
-                    }
-                }
-            }
-        }
-    }
-
-
-    @GetMapping(value = "/getJyData")
-    public void getJyData() throws Exception {
-
-        log.info("-------------------------获取快分销订单当前月数据开始数据开始--------------------------");
-        List<JSONObject> cookies = jiaoYangFenXiaoService.getCookie();
-        if (Check.isNull(cookies)) {
-            log.error("cookie数据为空");
-            return;
-        }
-
-        List<String> days = DateUtils.getDays("2023-12-01", "2024-02-28");
-        JSONArray hourList = KuaishouHourEnum.getHourList();
-        JSONArray minSecList = KuaishouMinSecEnum.getMinSecList();
-
-        for (int z = 0; z < days.size(); z++) {
-            String date = days.get(z);
-            for (int i = 0; i < hourList.size(); i++) {
-                String hour = hourList.getString(i);
-                for (int j = 0; j < minSecList.size(); j++) {
-                    JSONObject minSecJson = minSecList.getJSONObject(j);
-                    String startTime = minSecJson.getString("startTime");
-                    String endTime = minSecJson.getString("endTime");
-                    String start = date + hour + startTime;
-                    String end = date + hour + endTime;
-                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-                    Long orderCreateTimeStart = sdf.parse(start).getTime();
-                    Long orderCreateTimeEnd = sdf.parse(end).getTime();
-                    for (int p = 0; p < cookies.size(); p++) {
-                        JSONObject cookieJson = cookies.get(p);
-                        String cookie = cookieJson.getString("cookie");
-                        jy.submit(new Runnable() {
-                            @Override
-                            public void run() {
-                                try {
-                                    jiaoYangFenXiaoService.getOrderList(cookie, 0, orderCreateTimeStart, orderCreateTimeEnd);
+                                    mgskuaishouSupplyChainService.getOrderList(cookie, 0, orderCreateTimeStart, orderCreateTimeEnd, itemMap);
                                 } catch (Exception e) {
                                     e.printStackTrace();
                                 }
@@ -272,39 +210,8 @@ public class TestController {
         }
     }
 
-    @GetMapping(value = "/getSettlementData")
-    public void getsettlementData(String startDay, String endDay) throws Exception {
-        List<String> days = DateUtils.getDays(startDay, endDay);
-        List<JSONObject> cookies = ikuaishouSupplyChainService.getCookie();
-        JSONArray hourList = KuaishouHourEnum.getHourList();
-        JSONArray minSecList = KuaishouMinSecEnum.getMinSecList();
-        for (int z = 0; z < days.size(); z++) {
-            String date = days.get(z);
-            for (int i = 0; i < hourList.size(); i++) {
-                String hour = hourList.getString(i);
-                for (int j = 0; j < minSecList.size(); j++) {
-                    JSONObject minSecJson = minSecList.getJSONObject(j);
-                    String startTime = minSecJson.getString("startTime");
-                    String endTime = minSecJson.getString("endTime");
-                    String start = date + hour + startTime;
-                    String end = date + hour + endTime;
-                    System.err.println("开始时间:" + start);
-                    System.err.println("结束时间:" + end);
-                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-                    Long orderCreateTimeStart = sdf.parse(start).getTime();
-                    Long orderCreateTimeEnd = sdf.parse(end).getTime();
-                    for (int p = 0; p < cookies.size(); p++) {
-                        JSONObject cookieJson = cookies.get(p);
-                        String cookie = cookieJson.getString("cookie");
-                        ikuaishouSupplyChainService.getSettlementData(cookie, 0, orderCreateTimeStart, orderCreateTimeEnd);
-                    }
-                }
-            }
-
-        }
 
 
-    }
 
     @Value("${xxl-job.requestUrl}")
     private String jobUrl;

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

@@ -13,10 +13,7 @@ import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouUnitLevelOperationRecord
 import cn.com.ctop.kuaishou.modules.ai.mapper.AiKuaishouUnitLevelOperationRecordMapper;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouOperationRecord;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaishouOperationRecordMapper;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouReportDailyMaterialService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService2;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouProgramCreativeService;
+import cn.com.ctop.kuaishou.modules.batch.service.*;
 import cn.com.ctop.kuaishou.modules.dimension.service.IKuaiShouDimensionStrategyService;
 import cn.com.ctop.kuaishou.modules.dimension.service.IKuaiShouDimensionVariableService;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
@@ -111,6 +108,42 @@ public class SampleTest {
     private IOauthAgentTokenService agentTokenService;
     @Autowired
     private KuaiShouDailyAgentMapper agentMapper;
+    @Autowired
+    private IKuaishouSupplyChainService ikuaishouSupplyChainService;
+
+    @Test
+    public void getRuiXuanCcrInfo() throws ParseException, InterruptedException {
+        List<JSONObject> cookies = ikuaishouSupplyChainService.getCookie();
+        if (Check.isNull(cookies)) {
+            return;
+        }
+
+        for (int i = 0; i < cookies.size(); i++) {
+            JSONObject jsonObject = cookies.get(i);
+            String cookie = jsonObject.getString("cookie");
+            ikuaishouSupplyChainService.getCcrInfo(cookie, 100, "ruixuan");
+
+        }
+
+        Thread.sleep(5 * 1000);
+
+        List<JSONObject> mgsCookies = ikuaishouSupplyChainService.getMgsCookie();
+        for (int i = 0; i < mgsCookies.size(); i++) {
+            JSONObject jsonObject = mgsCookies.get(i);
+            String cookie = jsonObject.getString("cookie");
+            ikuaishouSupplyChainService.getCcrInfo(cookie, 100, "miaogousi");
+
+        }
+
+        Thread.sleep(5 * 1000);
+        List<JSONObject> rocketCookies = ikuaishouSupplyChainService.getRocketCookie();
+        for (int i = 0; i < rocketCookies.size(); i++) {
+            JSONObject jsonObject = rocketCookies.get(i);
+            String cookie = jsonObject.getString("cookie");
+            ikuaishouSupplyChainService.getCcrInfo(cookie, 100, "rocket");
+
+        }
+    }
 
     @Test
     public void loadKuaishouCookie() throws ParseException {
@@ -121,7 +154,7 @@ public class SampleTest {
             Long appId = appList.get(i);
             OauthAgentToken agentToken = agentTokenService.getTokenByAppId(appId);
             System.err.println(agentToken);
-           // getAgentReport(agentToken.getAccessToken(), agentToken.getAgentId(), startDate, endDate, 1);
+            // getAgentReport(agentToken.getAccessToken(), agentToken.getAgentId(), startDate, endDate, 1);
         }
     }
 
@@ -277,17 +310,19 @@ public class SampleTest {
 
     @Autowired
     private IEtlKuaishouVideoInfoService etlKuaishouVideoInfo;
+
     @Test
-    public void loadkuaishouVideoData(){
+    public void loadkuaishouVideoData() {
         String startDate = "2021-05-07";
-        for(int i=0;i<=60;i++){
-            String getDate = DateUtils.formatDate(DateUtils.addDay(startDate,i));
+        for (int i = 0; i <= 60; i++) {
+            String getDate = DateUtils.formatDate(DateUtils.addDay(startDate, i));
             etlKuaishouVideoInfo.etlKuaishouVideoInfo(getDate);
         }
     }
 
     @Autowired
     private IKuaiShouReportDailyMaterialService kuaiShouReportDailyMaterialService;
+
     @Test
     public void loadKuaishouMatData() throws InterruptedException {
         String startDate = "2021-06-18";
@@ -298,16 +333,17 @@ public class SampleTest {
         tokens.forEach(token -> executorService.submit(() -> {
             try {
                 kuaiShouReportDailyMaterialService.getMaterialReportByAccountIdAndStatDate(token.getAccountId(), token.getAccessToken(), startDate, endDate, "DAILY", 1);
-            }catch (Exception e){
-            }finally {
+            } catch (Exception e) {
+            } finally {
                 countDownLatch.countDown();
             }
         }));
         countDownLatch.await();
         System.out.println("数据获取完成");
     }
+
     @Test
-    public void loadKuaiShouMatHourlyData() throws InterruptedException{
+    public void loadKuaiShouMatHourlyData() throws InterruptedException {
 //        kuaiShouReportDailyMaterialService.getMaterialReportByAccountIdAndStatDate(7411077l, tokenService.getOauthTokenByAccountId("7411077").getAccessToken(), "2021-07-02", "2021-07-02", "HOURLY", 1);
 
         String startDate = "2021-07-19";
@@ -319,8 +355,8 @@ public class SampleTest {
         tokens.forEach(token -> executorService.submit(() -> {
             try {
                 kuaiShouReportDailyMaterialService.getMaterialReportByAccountIdAndStatDate(token.getAccountId(), token.getAccessToken(), startDate, endDate, "HOURLY", 1);
-            }catch (Exception e){
-            }finally {
+            } catch (Exception e) {
+            } finally {
                 countDownLatch.countDown();
             }
         }));
@@ -345,7 +381,7 @@ public class SampleTest {
         int recordsCount = 0;
         int newRecordCount = 0;
 
-        while (beginDate.before(endDate)){
+        while (beginDate.before(endDate)) {
             System.out.println("开始拆分数据,当前时间为:" + beginDate);
             List<KuaishouOperationRecord> records = kuaishouOperationRecordMapper.selectCreativeRecordByStatDate(DateUtils.formatDate(beginDate, "yyyy-MM-dd"));    //开始拆分数据,当前时间为:Tue Apr 28 00:00:00 CST 2020
 //            List<KuaishouOperationRecord> records = kuaishouOperationRecordMapper.selectAccountRecordByStatDate(DateUtils.formatDate(beginDate, "yyyy-MM-dd"));
@@ -391,12 +427,12 @@ public class SampleTest {
                 this.saveOperationRecordListToDb(newRecords);
                 beginDate = DateUtils.addDay(beginDate, 1);
             } else {
-        System.out.print("     -> 今日的数据为空!!!");
-        beginDate = DateUtils.addDay(beginDate, 1);
+                System.out.print("     -> 今日的数据为空!!!");
+                beginDate = DateUtils.addDay(beginDate, 1);
             }
         }
         System.out.println("---------------------------------------------------------------");
-        System.out.println("------------获取数据结束"+recordsCount+"条原始数据变成了"+newRecordCount+"条数据------------");
+        System.out.println("------------获取数据结束" + recordsCount + "条原始数据变成了" + newRecordCount + "条数据------------");
         System.out.println("---------------------------------------------------------------");
     }
 
@@ -457,11 +493,12 @@ public class SampleTest {
         }
     }
 
-    public void testfreshBytedanceUrl(){
+    public void testfreshBytedanceUrl() {
         etlReportBytedanceVideoService.etlBytedanceVideoClipIdJob(null);
         etlReportBytedanceVideoService.etlBytedanceVideoPlanInfoJob();
         etlReportBytedanceVideoService.etlBytedanceVideoShotInfoJob();
     }
+
     @Autowired
     IKuaishouInterfaceService2 kuaishouInterfaceServiceImpl2;
 
@@ -483,21 +520,21 @@ public class SampleTest {
         Date endDate = DateUtils.parseDate("2021-07-22", "yyyy-MM-dd");
 
         List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
-        while (beginDate.before(endDate)){
+        while (beginDate.before(endDate)) {
             Date mulDate = beginDate;
             countDownLatch = new CountDownLatch(tokens.size());
             tokens.forEach(token -> executorService.submit(() -> {
-                try{
-                    if(!accountIdList.contains(token.getAccountId())){
-                        kuaishouInterfaceServiceImpl2.getOperationRecord( token.getAccountId(),
+                try {
+                    if (!accountIdList.contains(token.getAccountId())) {
+                        kuaishouInterfaceServiceImpl2.getOperationRecord(token.getAccountId(),
                                 token.getAccessToken(),
                                 3,      //先3组   后2计划
-                                DateUtils.formatDate(mulDate,"yyyy-MM-dd"),
-                                DateUtils.formatDate(mulDate,"yyyy-MM-dd"));
-                        System.out.println("获取完毕 -> accountId:" + token.getAccountId() +",日期:" + DateUtils.formatDate(mulDate,"yyyy-MM-dd"));
+                                DateUtils.formatDate(mulDate, "yyyy-MM-dd"),
+                                DateUtils.formatDate(mulDate, "yyyy-MM-dd"));
+                        System.out.println("获取完毕 -> accountId:" + token.getAccountId() + ",日期:" + DateUtils.formatDate(mulDate, "yyyy-MM-dd"));
                     }
-                }catch (Exception e){
-                }finally {
+                } catch (Exception e) {
+                } finally {
                     countDownLatch.countDown();
                 }
             }));
@@ -513,6 +550,7 @@ public class SampleTest {
     IKuaishouAudienceReportDailyService kuaishouAudienceReportDailyService;
     @Resource
     AiKuaishouUnitLevelOperationRecordMapper kuaishouUnitLevelOperationRecordMapper;
+
     @Test
     public void getAudienceReport() throws InterruptedException {
         int page = 1;
@@ -520,28 +558,28 @@ public class SampleTest {
         Date beginDate = DateUtils.parseDate("2021-05-01", "yyyy-MM-dd");
         Date endDate = DateUtils.parseDate("2021-06-01", "yyyy-MM-dd");
 
-        while (beginDate.before(endDate)){
+        while (beginDate.before(endDate)) {
             Date mulDate = beginDate;
-            List<AiKuaishouUnitLevelOperationRecord> planIdsAndUnitIds = kuaishouUnitLevelOperationRecordMapper.selectAllByAccountId(mulDate, DateUtils.addDay(mulDate,1));
+            List<AiKuaishouUnitLevelOperationRecord> planIdsAndUnitIds = kuaishouUnitLevelOperationRecordMapper.selectAllByAccountId(mulDate, DateUtils.addDay(mulDate, 1));
             countDownLatch = new CountDownLatch(planIdsAndUnitIds.size());
             planIdsAndUnitIds.forEach(planIdAndUnitId -> executorService.submit(() -> {
-                try{
+                try {
                     CtopOauthToken token = tokenService.getTokenByAccountId(planIdAndUnitId.getAccountId());
-                    if(!Check.isNull(token)){
+                    if (!Check.isNull(token)) {
                         Date startDate = mulDate;
                         Date enDate = DateUtils.addDay(startDate, 30);
                         // province: 省级地域分布, city: 地级地域分布,gender: 性别分布,ageSegment: 年龄分布clientId: 系统分布 businessInterestTags: 商业兴趣分布
-                        while (startDate.before(enDate)){
-                            kuaishouAudienceReportDailyService.crowdAnalysisReport2(token, DateUtils.formatDate(startDate,"yyyy-MM-dd"), "ageSegment", planIdAndUnitId.getCampaignId(), planIdAndUnitId.getUnitId(), page, pageSize);
-                            System.out.println("获取完毕 -> unit:" + planIdAndUnitId.getUnitId() +",日期:" + DateUtils.formatDate(startDate,"yyyy-MM-dd"));
+                        while (startDate.before(enDate)) {
+                            kuaishouAudienceReportDailyService.crowdAnalysisReport2(token, DateUtils.formatDate(startDate, "yyyy-MM-dd"), "ageSegment", planIdAndUnitId.getCampaignId(), planIdAndUnitId.getUnitId(), page, pageSize);
+                            System.out.println("获取完毕 -> unit:" + planIdAndUnitId.getUnitId() + ",日期:" + DateUtils.formatDate(startDate, "yyyy-MM-dd"));
                             startDate = DateUtils.addDay(startDate, 1);
                         }
 
-                    }else {
-                        System.out.println("token异常 -》 accountId:"+planIdAndUnitId.getAccountId());
+                    } else {
+                        System.out.println("token异常 -》 accountId:" + planIdAndUnitId.getAccountId());
                     }
-                }catch (Exception e){
-                }finally {
+                } catch (Exception e) {
+                } finally {
                     countDownLatch.countDown();
                 }
             }));

+ 19 - 1
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/settlementJob.java

@@ -175,10 +175,28 @@ public class settlementJob {
         for (int i = 0; i < cookies.size(); i++) {
             JSONObject jsonObject = cookies.get(i);
             String cookie = jsonObject.getString("cookie");
-            ikuaishouSupplyChainService.getRuiXuanCcrInfo(cookie, 100, "ruixuan");
+            ikuaishouSupplyChainService.getCcrInfo(cookie, 0, "ruixuan");
 
         }
 
+        Thread.sleep(5 * 1000);
+
+        List<JSONObject> mgsCookies = ikuaishouSupplyChainService.getMgsCookie();
+        for (int i = 0; i < mgsCookies.size(); i++) {
+            JSONObject jsonObject = mgsCookies.get(i);
+            String cookie = jsonObject.getString("cookie");
+            ikuaishouSupplyChainService.getCcrInfo(cookie, 0, "miaogousi");
+
+        }
+
+        Thread.sleep(5 * 1000);
+        List<JSONObject> rocketCookies = ikuaishouSupplyChainService.getRocketCookie();
+        for (int i = 0; i < rocketCookies.size(); i++) {
+            JSONObject jsonObject = rocketCookies.get(i);
+            String cookie = jsonObject.getString("cookie");
+            ikuaishouSupplyChainService.getCcrInfo(cookie, 0, "rocket");
+
+        }
 
     }
 

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

@@ -47,4 +47,13 @@ public interface KuaishouSupplyChainMapper extends BaseMapper<KuaishouSupplyChai
 
     void cleanRocketKuaiShouPromoterBindChannel(@Param("date") Long date);
 
+    void replaceRuiXuanCcr(@Param("adds") List<JSONObject> adds);
+
+    void replaceMiaoGouSICcr(@Param("adds") List<JSONObject> adds);
+
+    void replaceRocketCcr(@Param("adds") List<JSONObject> adds);
+
+    List<JSONObject> getMgsCookie();
+
+    List<JSONObject> getRocketCookie();
 }

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

@@ -128,6 +128,46 @@
         group by t1.promoter_id
 
     </insert>
+    <insert id="replaceRuiXuanCcr" >
+        replace into ruixuan.kuaishou_item_ccr_info(
+        item_id,
+        ccr_value
+        )
+        values
+        <foreach collection="adds" item="add" separator=",">
+            (
+            #{add.itemId},
+            #{add.ccrValue}
+            )
+        </foreach>
+    </insert>
+    <insert id="replaceMiaoGouSICcr" >
+        replace into miaogousi.kuaishou_item_ccr_info(
+        item_id,
+        ccr_value
+        )
+        values
+        <foreach collection="adds" item="add" separator=",">
+        (
+        #{add.itemId},
+        #{add.ccrValue}
+        )
+        </foreach>
+    </insert>
+    <insert id="replaceRocketCcr" >
+        replace into rocket.kuaishou_item_ccr_info(
+        item_id,
+        ccr_value
+        )
+        values
+        <foreach collection="adds" item="add" separator=",">
+        (
+        #{add.itemId},
+        #{add.ccrValue}
+        )
+        </foreach>
+
+    </insert>
     <delete id="deletePromoterBindChannelByDate" parameterType="java.lang.Long">
         delete from ruixuan.promoter_bind_channel_date where stat_date = #{date}
     </delete>
@@ -285,5 +325,13 @@ group by t1.promoter_id;
                  left join rocket.kuaishou_settlement_rules tt
                            on t.ruleId = tt.id
     </select>
+    <select id="getMgsCookie" resultType="com.alibaba.fastjson.JSONObject">
+        select id, cookie
+        from miaogousi.kuaishou_supply_chain_cookie
+    </select>
+    <select id="getRocketCookie" resultType="com.alibaba.fastjson.JSONObject">
+        select id, cookie
+        from rocket.kuaishou_supply_chain_cookie
+    </select>
 
 </mapper>

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

@@ -45,5 +45,9 @@ public interface IKuaishouSupplyChainService extends IService<KuaishouSupplyChai
 
     List<JSONObject> getRocketDataList(Long statDate);
 
-    void getRuiXuanCcrInfo(String cookie, Integer offset, String type) throws InterruptedException;
+    void getCcrInfo(String cookie, Integer offset, String type) throws InterruptedException;
+
+    List<JSONObject> getMgsCookie();
+
+    List<JSONObject> getRocketCookie();
 }

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

@@ -137,26 +137,81 @@ public class KuaishouSupplyChainServiceImpl extends ServiceImpl<KuaishouSupplyCh
 
 
     @Override
-    public void getRuiXuanCcrInfo(String cookie, Integer offset, String type) throws InterruptedException {
+    public void getCcrInfo(String cookie, Integer offset, String type) throws InterruptedException {
         Thread.sleep(1000);
         Map<String, Object> params = new HashMap<>();
-
         params.put("filters", "{}");
         params.put("sorter", "{}");
         params.put("baseOrderStatus", 0);
         params.put("limit", 100);
         params.put("offset", offset);
-
         Map<String, String> headers = new HashMap<>();
         headers.put("Cookie", cookie);
 
         String resultStr = HttpUtils.httpPostFormRequest("https://cps.kwaixiaodian.com/gateway/distribute/platform/investment/activity/queryCrossActivityItem", params, headers);
         JSONObject result = JSONObject.parseObject(resultStr);
+        Integer result1 = result.getInteger("result");
+        if (result1 == 1) {
+            List<JSONObject> adds = new ArrayList<>();
+            if (!Check.isNull(result)) {
+                JSONObject data = result.getJSONObject("data");
+                if (!Check.isNull(data)) {
+                    JSONArray activityItem = data.getJSONArray("activityItem");
+                    if (!Check.isNull(activityItem)) {
+                        for (int i = 0; i < activityItem.size(); i++) {
+                            JSONObject jsonObject = activityItem.getJSONObject(i);
+                            if (!Check.isNull(jsonObject)) {
+                                Long itemId = jsonObject.getLong("itemId");
+                                JSONObject ccrInfo = jsonObject.getJSONObject("ccrInfo");
+                                if (!Check.isNull(ccrInfo)) {
+                                    JSONObject addJSon = new JSONObject();
+                                    String ccrValue = ccrInfo.getString("ccrValue");
+                                    addJSon.put("itemId", itemId);
+                                    addJSon.put("ccrValue", ccrValue);
+                                    adds.add(addJSon);
+                                } else {
+                                    log.info("ccr数据为空,团:{},itemId:{}", type, itemId);
+                                }
+                            }
+
+                        }
+
+
+                    }
+                }
 
-        System.err.println(resultStr);
-       /* if (list.size() >= 100) {
-            getOrderList(cookie, offset + 100, orderCreateTimeStart, orderCreateTimeEnd, itemMap);
-        }*/
+            }
+            if (!Check.isNull(adds)) {
+                if ("ruixuan".equals(type)) {
+                    supplyChainMapper.replaceRuiXuanCcr(adds);
+                }
+                if ("miaogousi".equals(type)) {
+                    supplyChainMapper.replaceMiaoGouSICcr(adds);
+                }
+                if ("rocket".equals(type)) {
+                    supplyChainMapper.replaceRocketCcr(adds);
+                }
+
+                if (adds.size() >= 100) {
+                    getCcrInfo(cookie, offset + 100, type);
+                }
+            }
+        } else {
+            log.error("{},获取ccr数据异常,返回数据: {}", type, result);
+            sendMessageService.sendMessage("113dee46c7df464da78c07a985e92cd1", type + "获取ccr数据失败,返回数据:" + resultStr);
+        }
+
+
+    }
+
+    @Override
+    public List<JSONObject> getMgsCookie() {
+        return supplyChainMapper.getMgsCookie();
+    }
+
+    @Override
+    public List<JSONObject> getRocketCookie() {
+        return supplyChainMapper.getRocketCookie();
     }