yumeng пре 1 година
родитељ
комит
f977872016

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

@@ -167,12 +167,38 @@ public class TestController {
 
     @GetMapping(value = "/getData")
     public void getDate(String startDate, String endDate) throws Exception {
+
         List<JSONObject> cookies = jiaoYangFenXiaoService.getCookie();
         if (Check.isNull(cookies)) {
             log.error("cookie数据为空");
             return;
         }
         String date = DateUtils.getNowDate("yyyy-MM-dd");
+        Long statDate = Long.valueOf(date.replace("-", ""));
+
+        List<Integer>  statusList = new ArrayList();
+        statusList.add(1);
+        statusList.add(2);
+        statusList.add(3);
+
+
+
+        for (int p = 0; p < cookies.size(); p++) {
+            JSONObject cookieJson = cookies.get(p);
+            String cookie = cookieJson.getString("cookie");
+            for (int i = 0; i < statusList.size(); i++) {
+                Integer status = statusList.get(i);
+                jiaoYangFenXiaoService.getClipCooperation(cookie, 0, statDate,status);
+            }
+
+        }
+
+      /*  List<JSONObject> cookies = jiaoYangFenXiaoService.getCookie();
+        if (Check.isNull(cookies)) {
+            log.error("cookie数据为空");
+            return;
+        }
+        String date = DateUtils.getNowDate("yyyy-MM-dd");
         JSONArray hourList = KuaishouHourEnum.getHourList();
         JSONArray minSecList = KuaishouMinSecEnum.getMinSecList();
         for (int i = 0; i < hourList.size(); i++) {
@@ -194,7 +220,7 @@ public class TestController {
                     jiaoYangFenXiaoService.getOrderList(cookie, 0, orderCreateTimeStart, orderCreateTimeEnd);
                 }
             }
-        }
+        }*/
     }
 
 

+ 37 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/JiaoYangFenXiaoJob.java

@@ -16,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.text.SimpleDateFormat;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
@@ -27,6 +28,41 @@ public class JiaoYangFenXiaoJob {
 
 
     /**
+     * 获取二创信息
+     *
+     * @throws Exception
+     */
+    @XxlJob("jyClipCooperation")
+    public void jyClipCooperation() throws Exception {
+
+        List<JSONObject> cookies = jiaoYangFenXiaoService.getCookie();
+        if (Check.isNull(cookies)) {
+            log.error("cookie数据为空");
+            return;
+        }
+        String date = DateUtils.getNowDate("yyyy-MM-dd");
+        Long statDate = Long.valueOf(date.replace("-", ""));
+
+        List<Integer> statusList = new ArrayList();
+        statusList.add(2);
+        statusList.add(3);
+        statusList.add(1);
+
+        for (int p = 0; p < cookies.size(); p++) {
+            JSONObject cookieJson = cookies.get(p);
+            String cookie = cookieJson.getString("cookie");
+            for (int i = 0; i < statusList.size(); i++) {
+                Integer status = statusList.get(i);
+                jiaoYangFenXiaoService.getClipCooperation(cookie, 0, statDate, status);
+            }
+
+        }
+
+
+    }
+
+
+    /**
      * 当天前前小时数据获取
      **/
     /**
@@ -188,6 +224,7 @@ public class JiaoYangFenXiaoJob {
 
     /**
      * 上个月数据获取
+     *
      * @throws Exception
      */
     @XxlJob("jyAllOrderGet")

+ 265 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/JyClipCooperation.java

@@ -0,0 +1,265 @@
+package cn.com.ctop.kuaishou.modules.batch.entity;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+
+/**
+ * 骄阳-二创者信息对象 jy_clip_cooperation
+ *
+ * @author ruoyi
+ * @date 2023-11-01
+ */
+public class JyClipCooperation {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * $column.columnComment
+     */
+    private Long clipId;
+
+    /**
+     * 二创者名称
+     */
+    @Excel(name = "二创者名称")
+    private String clipName;
+
+    /**
+     * 头像
+     */
+    @Excel(name = "头像")
+    private String headImg;
+
+    /**
+     * 二创佣金比例
+     */
+    @Excel(name = "二创佣金比例")
+    private Long commissionRate;
+
+    /**
+     * 粉丝数
+     */
+    @Excel(name = "粉丝数")
+    private String fansNum;
+
+    /**
+     * 创作者gmv
+     */
+    @Excel(name = "创作者gmv")
+    private String gmv30d;
+
+    /**
+     * 周期-开始日期
+     */
+    @Excel(name = "周期-开始日期")
+    private String startTime;
+
+    /**
+     * 周期-结束日期
+     */
+    @Excel(name = "周期-结束日期")
+    private String endTime;
+
+    /**
+     * 状态
+     */
+    @Excel(name = "状态")
+    private Integer status;
+
+    /**
+     * 状态
+     */
+    @Excel(name = "状态")
+    private String terminationReason;
+
+    /**
+     * 佣金比例
+     */
+    @Excel(name = "佣金比例")
+    private String commissionRateView;
+
+    /**
+     * 口碑评分
+     */
+    @Excel(name = "口碑评分")
+    private String shopScore;
+
+    /**
+     * 创作者30日gmv
+     */
+    @Excel(name = "创作者30日gmv")
+    private String clipGmv30d;
+
+    /**
+     * 授权商品gmv
+     */
+    @Excel(name = "授权商品gmv")
+    private String authItemGmv30d;
+
+    /**
+     * 挂车视频
+     */
+    @Excel(name = "挂车视频")
+    private String videoCount30d;
+
+    /**
+     * 日期
+     */
+    @Excel(name = "日期")
+    private Long statDate;
+
+    public static long getSerialVersionUID() {
+        return serialVersionUID;
+    }
+
+    public Long getClipId() {
+        return clipId;
+    }
+
+    public void setClipId(Long clipId) {
+        this.clipId = clipId;
+    }
+
+    public String getClipName() {
+        return clipName;
+    }
+
+    public void setClipName(String clipName) {
+        this.clipName = clipName;
+    }
+
+    public String getHeadImg() {
+        return headImg;
+    }
+
+    public void setHeadImg(String headImg) {
+        this.headImg = headImg;
+    }
+
+    public Long getCommissionRate() {
+        return commissionRate;
+    }
+
+    public void setCommissionRate(Long commissionRate) {
+        this.commissionRate = commissionRate;
+    }
+
+    public String getFansNum() {
+        return fansNum;
+    }
+
+    public void setFansNum(String fansNum) {
+        this.fansNum = fansNum;
+    }
+
+    public String getGmv30d() {
+        return gmv30d;
+    }
+
+    public void setGmv30d(String gmv30d) {
+        this.gmv30d = gmv30d;
+    }
+
+    public String getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(String startTime) {
+        this.startTime = startTime;
+    }
+
+    public String getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(String endTime) {
+        this.endTime = endTime;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public String getTerminationReason() {
+        return terminationReason;
+    }
+
+    public void setTerminationReason(String terminationReason) {
+        this.terminationReason = terminationReason;
+    }
+
+    public String getCommissionRateView() {
+        return commissionRateView;
+    }
+
+    public void setCommissionRateView(String commissionRateView) {
+        this.commissionRateView = commissionRateView;
+    }
+
+    public String getShopScore() {
+        return shopScore;
+    }
+
+    public void setShopScore(String shopScore) {
+        this.shopScore = shopScore;
+    }
+
+    public String getClipGmv30d() {
+        return clipGmv30d;
+    }
+
+    public void setClipGmv30d(String clipGmv30d) {
+        this.clipGmv30d = clipGmv30d;
+    }
+
+    public String getAuthItemGmv30d() {
+        return authItemGmv30d;
+    }
+
+    public void setAuthItemGmv30d(String authItemGmv30d) {
+        this.authItemGmv30d = authItemGmv30d;
+    }
+
+    public String getVideoCount30d() {
+        return videoCount30d;
+    }
+
+    public void setVideoCount30d(String videoCount30d) {
+        this.videoCount30d = videoCount30d;
+    }
+
+    public Long getStatDate() {
+        return statDate;
+    }
+
+    public void setStatDate(Long statDate) {
+        this.statDate = statDate;
+    }
+
+    @Override
+    public String toString() {
+        return "JyClipCooperation{" +
+                "clipId=" + clipId +
+                ", clipName='" + clipName + '\'' +
+                ", headImg='" + headImg + '\'' +
+                ", commissionRate=" + commissionRate +
+                ", fansNum='" + fansNum + '\'' +
+                ", gmv30d='" + gmv30d + '\'' +
+                ", startTime='" + startTime + '\'' +
+                ", endTime='" + endTime + '\'' +
+                ", status=" + status +
+                ", terminationReason='" + terminationReason + '\'' +
+                ", commissionRateView='" + commissionRateView + '\'' +
+                ", shopScore='" + shopScore + '\'' +
+                ", clipGmv30d='" + clipGmv30d + '\'' +
+                ", authItemGmv30d='" + authItemGmv30d + '\'' +
+                ", videoCount30d='" + videoCount30d + '\'' +
+                ", statDate=" + statDate +
+                '}';
+    }
+}

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

@@ -1,5 +1,6 @@
 package cn.com.ctop.kuaishou.modules.batch.mapper;
 
+import cn.com.ctop.kuaishou.modules.batch.entity.JyClipCooperation;
 import cn.com.ctop.kuaishou.modules.batch.entity.JyOrderList;
 import com.alibaba.fastjson.JSONObject;
 import org.apache.ibatis.annotations.Param;
@@ -11,4 +12,6 @@ public interface JiaoYangFenXiaoMapper {
 
 
     void replace(@Param("adds") List<JyOrderList> adds);
+
+    void replaceClipCooperation(@Param("adds") List<JyClipCooperation> adds);
 }

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

@@ -69,6 +69,50 @@
 
 
     </insert>
+    <insert id="replaceClipCooperation">
+        replace into ruixuan.jy_clip_cooperation(
+        clip_id,
+        clip_name,
+        head_img,
+        commission_rate,
+        fans_num,
+        gmv_30d,
+        start_time,
+        end_time,
+        status,
+        termination_reason,
+        commission_rate_view,
+        shop_score,
+        clip_gmv_30d,
+        auth_item_gmv_30d,
+        video_count_30d,
+        stat_date
+        )
+        values
+        <foreach collection="adds" item="add" separator=",">
+        (
+        #{add.clipId},
+        #{add.clipName},
+        #{add.headImg},
+        #{add.commissionRate},
+        #{add.fansNum},
+        #{add.gmv30d},
+        #{add.startTime},
+        #{add.endTime},
+        #{add.status},
+        #{add.terminationReason},
+        #{add.commissionRateView},
+        #{add.shopScore},
+        #{add.clipGmv30d},
+        #{add.authItemGmv30d},
+        #{add.videoCount30d},
+        #{add.statDate}
+
+        )
+        </foreach>
+
+
+    </insert>
 
 
     <select id="getCookie" resultType="com.alibaba.fastjson.JSONObject">

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

@@ -8,4 +8,6 @@ public interface IJiaoYangFenXiaoService {
     List<JSONObject> getCookie();
 
     void getOrderList(String cookie, Integer offset, Long orderCreateTimeStart, Long orderCreateTimeEnd) throws Exception;
+
+    void getClipCooperation(String cookie, Integer offset, Long statDate,Integer status) throws Exception;
 }

+ 63 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/JiaoYangFenXiaoServiceImpl.java

@@ -3,6 +3,7 @@ package cn.com.ctop.kuaishou.modules.batch.service.impl;
 import cn.com.ctop.common.module.service.ISendMessageService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.ctop.kuaishou.modules.batch.entity.JyClipCooperation;
 import cn.com.ctop.kuaishou.modules.batch.entity.JyOrderList;
 
 import cn.com.ctop.kuaishou.modules.batch.mapper.JiaoYangFenXiaoMapper;
@@ -45,7 +46,7 @@ public class JiaoYangFenXiaoServiceImpl implements IJiaoYangFenXiaoService {
         if (!Check.isNull(orderCreateTimeEnd)) {
             params.put("orderCreateTimeEnd", orderCreateTimeEnd);
         }
-      //  params.put("fundType", 1);
+        //  params.put("fundType", 1);
         params.put("limit", 200);
         params.put("offset", offset);
 
@@ -118,6 +119,67 @@ public class JiaoYangFenXiaoServiceImpl implements IJiaoYangFenXiaoService {
 
     }
 
+    @Override
+    public void getClipCooperation(String cookie, Integer offset, Long statDate,Integer status) throws Exception {
+        Thread.sleep(500L);
+        Map<String, Object> params = new HashMap<>();
+        params.put("status", status);
+        params.put("limit", 200);
+        params.put("offset", offset);
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Cookie", cookie);
+        String postUrl = "https://cps.kwaixiaodian.com/gateway/distribute/platform/recreate/leader/clip/cooperation/list";
+        String resultStr = HttpUtils.httpPostRequest(postUrl, params, headers);
+        JSONObject result = JSONObject.parseObject(resultStr);
+        if (Check.isNull(result)) {
+            log.error("骄阳分销数据返回为空");
+            return;
+        }
+        Integer code = result.getInteger("result");
+        if (code != 1) {
+            log.info("骄阳分销数据返回异常:", resultStr);
+            sendMessageService.sendMessage("113dee46c7df464da78c07a985e92cd1", "骄阳分销cookie失效,请及时更新。媒体返回信息:" + resultStr);
+            return;
+        }
+        JSONObject dataJson = result.getJSONObject("data");
+        if (Check.isNull(dataJson)) {
+            log.error("骄阳分销数据返回为data数据为空");
+            return;
+        }
+        JSONArray list = dataJson.getJSONArray("leaderCoopClip");
+        if (Check.isNull(list)) {
+            log.error("骄阳分销数据返回为list数据为空");
+            return;
+        }
+        log.info("骄阳分销当前数据条数:{}", list.size());
+        List<JyClipCooperation> adds = new ArrayList<>();
+        for (int i = 0; i < list.size(); i++) {
+            JSONObject jsonObject = list.getJSONObject(i);
+            JyClipCooperation clipCooperation = new JyClipCooperation();
+            clipCooperation.setClipId(jsonObject.getLong("clipId"));
+            clipCooperation.setClipName(jsonObject.getString("clipName"));
+            clipCooperation.setHeadImg(jsonObject.getString("headImg"));
+            clipCooperation.setCommissionRate(jsonObject.getLong("commissionRate"));
+            clipCooperation.setFansNum(jsonObject.getString("fansNum"));
+            clipCooperation.setGmv30d(jsonObject.getString("gmv30d"));
+            clipCooperation.setStartTime(jsonObject.getString("startTime"));
+            clipCooperation.setEndTime(jsonObject.getString("endTime"));
+            clipCooperation.setStatus(jsonObject.getInteger("status"));
+            clipCooperation.setTerminationReason(jsonObject.getString("terminationReason"));
+            clipCooperation.setCommissionRateView(jsonObject.getString("commissionRateView"));
+            clipCooperation.setShopScore(jsonObject.getString("shopScore"));
+            clipCooperation.setClipGmv30d(jsonObject.getString("clipGmv30d"));
+            clipCooperation.setAuthItemGmv30d(jsonObject.getString("authItemGmv30d"));
+            clipCooperation.setVideoCount30d(jsonObject.getString("videoCount30d"));
+            clipCooperation.setStatDate(statDate);
+            adds.add(clipCooperation);
+        }
+        jiaoYangFenXiaoMapper.replaceClipCooperation(adds);
+        if (list.size() >= 200) {
+            getClipCooperation(cookie, offset + 200, statDate,status);
+        }
+    }
+
 
     public static String filterSupplement(String content) {
         StringBuilder sb = new StringBuilder();