yumeng 1 year ago
parent
commit
2afff99e9c

+ 8 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DateUtils.java

@@ -349,6 +349,14 @@ public class DateUtils extends PropertyEditorSupport {
     }
 
 
+    public static Long tempToLongDate(long millis) {
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        Date d1 = new Date(millis);
+        String d2 = simpleDateFormat.format(d1);
+        Long longDate = Long.valueOf(d2.replace("-", ""));
+        return longDate;
+    }
+
     public static String temp13ToDate(long millis) {
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         Date d1 = new Date(millis);

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

@@ -155,6 +155,9 @@ public class TestController {
     @Autowired
     private IKuaiShouActivityItemListService activityItemListService;
 
+    @Autowired
+    private IJiaoYangFenXiaoService jiaoYangFenXiaoService;
+
     public static void main(String[] args) {
         List<String> days = DateUtils.getDays("2023-08-01", "2023-09-25");
         System.err.println(days);
@@ -164,13 +167,33 @@ public class TestController {
 
     @GetMapping(value = "/getData")
     public void getDate(String startDate, String endDate) throws Exception {
-
-        List<String> days = DateUtils.getDays("2023-08-01", "2023-09-25");
-        for (int i = 0; i < days.size(); i++) {
-            Long date = Long.valueOf(days.get(i).replace("-",""));
-            System.err.println("当前日期:"+ date);
-            ikuaishouSupplyChainService.deletePromoterBindChannelByDate(date);
-            ikuaishouSupplyChainService.cleanPromoterBindChannel(date);
+        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++) {
+            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");
+                    jiaoYangFenXiaoService.getOrderList(cookie, 0, orderCreateTimeStart, orderCreateTimeEnd);
+                }
+            }
         }
     }
 

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

@@ -0,0 +1,236 @@
+package cn.com.ctop.job.kuaishou.handler;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.batch.Enums.KuaishouHourEnum;
+import cn.com.ctop.kuaishou.modules.batch.Enums.KuaishouMinSecEnum;
+import cn.com.ctop.kuaishou.modules.batch.service.IJiaoYangFenXiaoService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouActivityInfoService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouActivityItemListService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouSupplyChainService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.text.SimpleDateFormat;
+import java.util.List;
+import java.util.Map;
+
+@Slf4j
+@Component
+public class JiaoYangFenXiaoJob {
+    @Autowired
+    private IJiaoYangFenXiaoService jiaoYangFenXiaoService;
+
+
+    /**
+     * 当天前前小时数据获取
+     **/
+    /**
+     * 当天数据获取
+     **/
+    @XxlJob("jyFrontHourOrderGet")
+    public void frontHourOrderGet() throws Exception {
+
+        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++) {
+            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");
+                    jiaoYangFenXiaoService.getOrderList(cookie, 0, orderCreateTimeStart, orderCreateTimeEnd);
+                }
+            }
+        }
+
+
+    }
+
+
+    /**
+     * 昨日快分销数据获取
+     **/
+    @XxlJob("jyYesterdayOrderGet")
+    public void jyYesterdayOrderGet() throws Exception {
+        log.info("-------------------------获取快分销订单昨日数据开始数据开始--------------------------");
+        List<JSONObject> cookies = jiaoYangFenXiaoService.getCookie();
+        if (Check.isNull(cookies)) {
+            log.error("cookie数据为空");
+            return;
+        }
+        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+        String date = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
+        JSONArray hourList = KuaishouHourEnum.getHourList();
+        JSONArray minSecList = KuaishouMinSecEnum.getMinSecList();
+        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");
+                    jiaoYangFenXiaoService.getOrderList(cookie, 0, orderCreateTimeStart, orderCreateTimeEnd);
+                }
+            }
+        }
+    }
+
+
+    /**
+     * 前日日快分销数据获取
+     **/
+    @XxlJob("jyBeforeYesterdayOrderGet")
+    public void jyBeforeYesterdayOrderGet() throws Exception {
+        log.info("-------------------------获取快分销订单前日数据开始数据开始--------------------------");
+        List<JSONObject> cookies = jiaoYangFenXiaoService.getCookie();
+        if (Check.isNull(cookies)) {
+            log.error("cookie数据为空");
+            return;
+        }
+        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+        String date = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -2);
+        JSONArray hourList = KuaishouHourEnum.getHourList();
+        JSONArray minSecList = KuaishouMinSecEnum.getMinSecList();
+        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");
+                    jiaoYangFenXiaoService.getOrderList(cookie, 0, orderCreateTimeStart, orderCreateTimeEnd);
+                }
+
+            }
+        }
+    }
+
+
+    /**
+     * 快分销-当前月所有数据
+     **/
+    @XxlJob("jyNowMonthyOrderGet")
+    public void jyNowMonthyOrderGet() throws Exception {
+        List<JSONObject> cookies = jiaoYangFenXiaoService.getCookie();
+        if (Check.isNull(cookies)) {
+            log.error("cookie数据为空");
+            return;
+        }
+        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+        String endDate = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -3);
+        String monthFirstDay = DateUtils.getMonthFirstDay();
+        List<String> days = DateUtils.getDays(monthFirstDay, endDate);
+        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");
+                        jiaoYangFenXiaoService.getOrderList(cookie, 0, orderCreateTimeStart, orderCreateTimeEnd);
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * 上个月数据获取
+     * @throws Exception
+     */
+    @XxlJob("jyAllOrderGet")
+    public void jyAllOrderGet() throws Exception {
+        //   List<String> dateList = new ArrayList<>();
+        Map<String, String> monthStartAndEnd = DateUtils.getMonthStartAndEnd();
+        String firstDay = monthStartAndEnd.get("firstDay");
+        String lastDay = monthStartAndEnd.get("lastDay");
+        List<String> days = DateUtils.getDays(firstDay, lastDay);
+        List<JSONObject> cookies = jiaoYangFenXiaoService.getCookie();
+        if (Check.isNull(cookies)) {
+            log.error("cookie数据为空");
+            return;
+        }
+
+
+        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");
+                        jiaoYangFenXiaoService.getOrderList(cookie, 0, orderCreateTimeStart, orderCreateTimeEnd);
+                    }
+                }
+            }
+
+        }
+    }
+
+
+}

+ 2 - 14
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouOrderLIstGetJob.java

@@ -132,6 +132,7 @@ public class KuaishouOrderLIstGetJob {
     }
 
 
+
     /**
      * 快分销-当前月所有数据
      **/
@@ -302,20 +303,7 @@ public class KuaishouOrderLIstGetJob {
     }
 
 
-    public static void main(String[] args) {
-        Integer nowHour = null;
-        try {
-            nowHour = DateUtils.getNowHour();
-        } catch (ParseException e) {
-            e.printStackTrace();
-        }
-       List<Integer> hours = new ArrayList<>();
-        hours.add(nowHour);
-        if (nowHour >= 1) {
-            hours.add(nowHour - 1);
-        }
-        System.err.println(hours);
-    }
+
 
     /**
      * 当天前前小时数据获取

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

@@ -0,0 +1,390 @@
+package cn.com.ctop.kuaishou.modules.batch.entity;
+
+
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+
+/**
+ * 骄阳-快分销数据对象 jy_order_list
+ *
+ * @author ruoyi
+ * @date 2023-10-31
+ */
+public class JyOrderList
+{
+    private static final long serialVersionUID = 1L;
+
+    /** $column.columnComment */
+    private Long oid;
+
+    /** 商品ID */
+    @Excel(name = "商品ID")
+    private Long itemId;
+
+    /** 商品标题 */
+    @Excel(name = "商品标题")
+    private String itemTitle;
+
+    /** 商品单价 */
+    @Excel(name = "商品单价")
+    private Long reservePrice;
+
+    /** 商品图片 */
+    @Excel(name = "商品图片")
+    private String imageUrl;
+
+    /** 订单状态 */
+    @Excel(name = "订单状态")
+    private Integer orderStatus;
+
+    /** 订单创建时间 */
+    @Excel(name = "订单创建时间")
+    private Long orderCreateTime;
+
+    /** 是否发货(1-发货) */
+    @Excel(name = "是否发货")
+    private Integer sendStatus;
+
+    /** 订单类型 */
+    @Excel(name = "订单类型")
+    private Integer settlementBizType;
+
+    /** 订单类型翻译 */
+    @Excel(name = "订单类型翻译")
+    private String settlementBizTypeDesc;
+
+    /** 发货时间 */
+    @Excel(name = "发货时间")
+    private Long sendTime;
+
+    /** 收获时间 */
+    @Excel(name = "收获时间")
+    private Long recvTime;
+
+    /** 商家id */
+    @Excel(name = "商家id")
+    private Long sellerId;
+
+    /** 推广者id */
+    @Excel(name = "推广者id")
+    private Long promotionId;
+
+    /** 推广者昵称 */
+    @Excel(name = "推广者昵称")
+    private String promotionNickName;
+
+    /** 二创者id */
+    @Excel(name = "二创者id")
+    private Long clipUserId;
+
+    /** 二创者昵称 */
+    @Excel(name = "二创者昵称")
+    private String clipNickName;
+
+    /** 活动id */
+    @Excel(name = "活动id")
+    private Long activityId;
+
+    /** 订单金额 */
+    @Excel(name = "订单金额")
+    private Long orderAmount;
+
+    /** 付款金额 */
+    @Excel(name = "付款金额")
+    private Long payAmount;
+
+    /** 服务费率 */
+    @Excel(name = "服务费率")
+    private Long regimentalPromotionRate;
+
+    /** 分成比例 */
+    @Excel(name = "分成比例")
+    private Long shareRate;
+
+    /** 货款基数 */
+    @Excel(name = "货款基数")
+    private Long baseAmount;
+
+    /** 技术服务费 */
+    @Excel(name = "技术服务费")
+    private Long serviceAmount;
+
+    /** 商品推广佣金率 */
+    @Excel(name = "商品推广佣金率")
+    private Long commissionRate;
+
+    /** 预估服务费收入 */
+    @Excel(name = "预估服务费收入")
+    private Long regimentalPromotionAmount;
+
+    /** 结算服务费收入 */
+    @Excel(name = "结算服务费收入")
+    private Long totalRegimentalSettleAmount;
+
+    /** 订单时间 */
+    @Excel(name = "订单时间")
+    private Long statDate;
+
+    public static long getSerialVersionUID() {
+        return serialVersionUID;
+    }
+
+    public Long getOid() {
+        return oid;
+    }
+
+    public void setOid(Long oid) {
+        this.oid = oid;
+    }
+
+    public Long getItemId() {
+        return itemId;
+    }
+
+    public void setItemId(Long itemId) {
+        this.itemId = itemId;
+    }
+
+    public String getItemTitle() {
+        return itemTitle;
+    }
+
+    public void setItemTitle(String itemTitle) {
+        this.itemTitle = itemTitle;
+    }
+
+    public Long getReservePrice() {
+        return reservePrice;
+    }
+
+    public void setReservePrice(Long reservePrice) {
+        this.reservePrice = reservePrice;
+    }
+
+    public String getImageUrl() {
+        return imageUrl;
+    }
+
+    public void setImageUrl(String imageUrl) {
+        this.imageUrl = imageUrl;
+    }
+
+    public Integer getOrderStatus() {
+        return orderStatus;
+    }
+
+    public void setOrderStatus(Integer orderStatus) {
+        this.orderStatus = orderStatus;
+    }
+
+    public Long getOrderCreateTime() {
+        return orderCreateTime;
+    }
+
+    public void setOrderCreateTime(Long orderCreateTime) {
+        this.orderCreateTime = orderCreateTime;
+    }
+
+    public Integer getSendStatus() {
+        return sendStatus;
+    }
+
+    public void setSendStatus(Integer sendStatus) {
+        this.sendStatus = sendStatus;
+    }
+
+    public Integer getSettlementBizType() {
+        return settlementBizType;
+    }
+
+    public void setSettlementBizType(Integer settlementBizType) {
+        this.settlementBizType = settlementBizType;
+    }
+
+    public String getSettlementBizTypeDesc() {
+        return settlementBizTypeDesc;
+    }
+
+    public void setSettlementBizTypeDesc(String settlementBizTypeDesc) {
+        this.settlementBizTypeDesc = settlementBizTypeDesc;
+    }
+
+    public Long getSendTime() {
+        return sendTime;
+    }
+
+    public void setSendTime(Long sendTime) {
+        this.sendTime = sendTime;
+    }
+
+    public Long getRecvTime() {
+        return recvTime;
+    }
+
+    public void setRecvTime(Long recvTime) {
+        this.recvTime = recvTime;
+    }
+
+    public Long getSellerId() {
+        return sellerId;
+    }
+
+    public void setSellerId(Long sellerId) {
+        this.sellerId = sellerId;
+    }
+
+    public Long getPromotionId() {
+        return promotionId;
+    }
+
+    public void setPromotionId(Long promotionId) {
+        this.promotionId = promotionId;
+    }
+
+    public String getPromotionNickName() {
+        return promotionNickName;
+    }
+
+    public void setPromotionNickName(String promotionNickName) {
+        this.promotionNickName = promotionNickName;
+    }
+
+    public Long getClipUserId() {
+        return clipUserId;
+    }
+
+    public void setClipUserId(Long clipUserId) {
+        this.clipUserId = clipUserId;
+    }
+
+    public String getClipNickName() {
+        return clipNickName;
+    }
+
+    public void setClipNickName(String clipNickName) {
+        this.clipNickName = clipNickName;
+    }
+
+    public Long getActivityId() {
+        return activityId;
+    }
+
+    public void setActivityId(Long activityId) {
+        this.activityId = activityId;
+    }
+
+    public Long getOrderAmount() {
+        return orderAmount;
+    }
+
+    public void setOrderAmount(Long orderAmount) {
+        this.orderAmount = orderAmount;
+    }
+
+    public Long getPayAmount() {
+        return payAmount;
+    }
+
+    public void setPayAmount(Long payAmount) {
+        this.payAmount = payAmount;
+    }
+
+    public Long getRegimentalPromotionRate() {
+        return regimentalPromotionRate;
+    }
+
+    public void setRegimentalPromotionRate(Long regimentalPromotionRate) {
+        this.regimentalPromotionRate = regimentalPromotionRate;
+    }
+
+    public Long getShareRate() {
+        return shareRate;
+    }
+
+    public void setShareRate(Long shareRate) {
+        this.shareRate = shareRate;
+    }
+
+    public Long getBaseAmount() {
+        return baseAmount;
+    }
+
+    public void setBaseAmount(Long baseAmount) {
+        this.baseAmount = baseAmount;
+    }
+
+    public Long getServiceAmount() {
+        return serviceAmount;
+    }
+
+    public void setServiceAmount(Long serviceAmount) {
+        this.serviceAmount = serviceAmount;
+    }
+
+    public Long getCommissionRate() {
+        return commissionRate;
+    }
+
+    public void setCommissionRate(Long commissionRate) {
+        this.commissionRate = commissionRate;
+    }
+
+    public Long getRegimentalPromotionAmount() {
+        return regimentalPromotionAmount;
+    }
+
+    public void setRegimentalPromotionAmount(Long regimentalPromotionAmount) {
+        this.regimentalPromotionAmount = regimentalPromotionAmount;
+    }
+
+    public Long getTotalRegimentalSettleAmount() {
+        return totalRegimentalSettleAmount;
+    }
+
+    public void setTotalRegimentalSettleAmount(Long totalRegimentalSettleAmount) {
+        this.totalRegimentalSettleAmount = totalRegimentalSettleAmount;
+    }
+
+    public Long getStatDate() {
+        return statDate;
+    }
+
+    public void setStatDate(Long statDate) {
+        this.statDate = statDate;
+    }
+
+    @Override
+    public String toString() {
+        return "JyOrderList{" +
+                "oid=" + oid +
+                ", itemId=" + itemId +
+                ", itemTitle='" + itemTitle + '\'' +
+                ", reservePrice=" + reservePrice +
+                ", imageUrl='" + imageUrl + '\'' +
+                ", orderStatus=" + orderStatus +
+                ", orderCreateTime=" + orderCreateTime +
+                ", sendStatus=" + sendStatus +
+                ", settlementBizType=" + settlementBizType +
+                ", settlementBizTypeDesc='" + settlementBizTypeDesc + '\'' +
+                ", sendTime=" + sendTime +
+                ", recvTime=" + recvTime +
+                ", sellerId=" + sellerId +
+                ", promotionId=" + promotionId +
+                ", promotionNickName='" + promotionNickName + '\'' +
+                ", clipUserId=" + clipUserId +
+                ", clipNickName='" + clipNickName + '\'' +
+                ", activityId=" + activityId +
+                ", orderAmount=" + orderAmount +
+                ", payAmount=" + payAmount +
+                ", regimentalPromotionRate=" + regimentalPromotionRate +
+                ", shareRate=" + shareRate +
+                ", baseAmount=" + baseAmount +
+                ", serviceAmount=" + serviceAmount +
+                ", commissionRate=" + commissionRate +
+                ", regimentalPromotionAmount=" + regimentalPromotionAmount +
+                ", totalRegimentalSettleAmount=" + totalRegimentalSettleAmount +
+                ", statDate=" + statDate +
+                '}';
+    }
+}
+

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

@@ -0,0 +1,14 @@
+package cn.com.ctop.kuaishou.modules.batch.mapper;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.JyOrderList;
+import com.alibaba.fastjson.JSONObject;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface JiaoYangFenXiaoMapper {
+    List<JSONObject> getCookie();
+
+
+    void replace(@Param("adds") List<JyOrderList> adds);
+}

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

@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.kuaishou.modules.batch.mapper.JiaoYangFenXiaoMapper">
+    <insert id="replace">
+        replace into ruixuan.jy_order_list(
+        oid,
+        item_id,
+        item_title,
+        reserve_price,
+        image_url,
+        order_status,
+        order_create_time,
+        send_status,
+        settlement_biz_type,
+        settlement_biz_type_desc,
+        send_time,
+        recv_time,
+        seller_id,
+        promotion_id,
+        promotion_nick_name,
+        clip_user_id,
+        clip_nick_name,
+        activity_id,
+        order_amount,
+        pay_amount,
+        regimental_promotion_rate,
+        share_rate,
+        base_amount,
+        service_amount,
+        regimental_promotion_amount,
+        total_regimental_settle_amount,
+        stat_date,
+        commission_rate
+        )
+        values
+        <foreach collection="adds" item="add" separator=",">
+            (
+            #{add.oid},
+            #{add.itemId},
+            #{add.itemTitle},
+            #{add.reservePrice},
+            #{add.imageUrl},
+            #{add.orderStatus},
+            #{add.orderCreateTime},
+            #{add.sendStatus},
+            #{add.settlementBizType},
+            #{add.settlementBizTypeDesc},
+            #{add.sendTime},
+            #{add.recvTime},
+            #{add.sellerId},
+            #{add.promotionId},
+            #{add.promotionNickName},
+            #{add.clipUserId},
+            #{add.clipNickName},
+            #{add.activityId},
+            #{add.orderAmount},
+            #{add.payAmount},
+            #{add.regimentalPromotionRate},
+            #{add.shareRate},
+            #{add.baseAmount},
+            #{add.serviceAmount},
+            #{add.regimentalPromotionAmount},
+            #{add.totalRegimentalSettleAmount},
+            #{add.statDate},
+            #{add.commissionRate}
+            )
+
+        </foreach>
+
+
+    </insert>
+
+
+    <select id="getCookie" resultType="com.alibaba.fastjson.JSONObject">
+        select id as 'id',   cookie as 'cookie' from ruixuan.jy_fx_cookie
+
+
+    </select>
+</mapper>

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

@@ -63,6 +63,7 @@
             #{add.statDate},
             #{add.itemCommissionRate}
             )
+
         </foreach>
     </insert>
     <insert id="replaceSettlement">

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

@@ -0,0 +1,11 @@
+package cn.com.ctop.kuaishou.modules.batch.service;
+
+import com.alibaba.fastjson.JSONObject;
+
+import java.util.List;
+
+public interface IJiaoYangFenXiaoService {
+    List<JSONObject> getCookie();
+
+    void getOrderList(String cookie, Integer offset, Long orderCreateTimeStart, Long orderCreateTimeEnd) throws Exception;
+}

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

@@ -0,0 +1,132 @@
+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.JyOrderList;
+
+import cn.com.ctop.kuaishou.modules.batch.mapper.JiaoYangFenXiaoMapper;
+import cn.com.ctop.kuaishou.modules.batch.service.IJiaoYangFenXiaoService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Slf4j
+@Service
+public class JiaoYangFenXiaoServiceImpl implements IJiaoYangFenXiaoService {
+
+    private static String url = "https://cps.kwaixiaodian.com/gateway/distribute/platform/mcn/order/list";
+
+    @Autowired
+    private JiaoYangFenXiaoMapper jiaoYangFenXiaoMapper;
+    @Autowired
+    private ISendMessageService sendMessageService;
+
+    @Override
+    public List<JSONObject> getCookie() {
+        return jiaoYangFenXiaoMapper.getCookie();
+    }
+
+    @Override
+    public void getOrderList(String cookie, Integer offset, Long orderCreateTimeStart, Long orderCreateTimeEnd) throws Exception {
+        Thread.sleep(500L);
+        Map<String, Object> params = new HashMap<>();
+        if (!Check.isNull(orderCreateTimeStart)) {
+            params.put("orderCreateTimeStart", orderCreateTimeStart);
+        }
+        if (!Check.isNull(orderCreateTimeEnd)) {
+            params.put("orderCreateTimeEnd", orderCreateTimeEnd);
+        }
+      //  params.put("fundType", 1);
+        params.put("limit", 200);
+        params.put("offset", offset);
+
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Cookie", cookie);
+
+        String resultStr = HttpUtils.KuaiShouttpGetRequest(url, params, headers);
+        JSONObject result = JSONObject.parseObject(resultStr);
+        if (Check.isNull(result)) {
+            log.error("骄阳分销数据返回为空");
+            return;
+        }
+        Integer code = result.getInteger("result");
+        if (code != 1) {
+            log.info("骄阳分销数据返回异常:", resultStr);
+            sendMessageService.sendMessage("113dee46c7df464da78c07a985e92cd1", "骄阳分销cookie失效,请及时更新。媒体返回信息:" + resultStr);
+            return;
+        }
+        JSONObject dataJson = result.getJSONObject("data");
+        if (Check.isNull(dataJson)) {
+            log.error("骄阳分销数据返回为data数据为空");
+            return;
+        }
+        JSONArray list = dataJson.getJSONArray("list");
+        if (Check.isNull(list)) {
+            log.error("骄阳分销数据返回为list数据为空");
+            return;
+        }
+        log.info("骄阳分销当前数据条数:{}", list.size());
+        List<JyOrderList> orders = new ArrayList<>();
+        for (int i = 0; i < list.size(); i++) {
+            JSONObject jsonObject = list.getJSONObject(i);
+            JyOrderList order = new JyOrderList();
+            order.setOid(jsonObject.getLong("oid"));
+            JSONObject item = jsonObject.getJSONArray("itemList").getJSONObject(0);
+            if (!Check.isNull(item)) {
+                order.setItemId(item.getLong("itemId"));
+                order.setItemTitle(item.getString("itemTitle"));
+                order.setReservePrice(item.getLong("reservePrice"));
+                order.setImageUrl(item.getString("imageUrl"));
+            }
+            order.setOrderStatus(jsonObject.getInteger("orderStatus"));
+            order.setOrderCreateTime(jsonObject.getLong("orderCreateTime"));
+            order.setSendStatus(jsonObject.getInteger("sendStatus"));
+            order.setSettlementBizType(jsonObject.getInteger("settlementBizType"));
+            order.setSettlementBizTypeDesc(jsonObject.getString("settlementBizTypeDesc"));
+            order.setSendTime(jsonObject.getLong("sendTime"));
+            order.setRecvTime(jsonObject.getLong("recvTime"));
+            order.setSellerId(jsonObject.getLong("sellerId"));
+            order.setPromotionId(jsonObject.getLong("promotionId"));
+            order.setPromotionNickName(filterSupplement(jsonObject.getString("promotionNickName")));
+            order.setClipUserId(jsonObject.getLong("clipUserId"));
+            order.setClipNickName(jsonObject.getString("clipNickName"));
+            order.setActivityId(jsonObject.getLong("activityId"));
+            order.setOrderAmount(jsonObject.getLong("orderAmount"));
+            order.setPayAmount(jsonObject.getLong("payAmount"));
+            order.setRegimentalPromotionRate(jsonObject.getLong("regimentalPromotionRate"));
+            order.setShareRate(jsonObject.getLong("shareRate"));
+            order.setBaseAmount(jsonObject.getLong("baseAmount"));
+            order.setCommissionRate(jsonObject.getLong("commissionRate"));
+            order.setRegimentalPromotionAmount(jsonObject.getLong("regimentalPromotionAmount"));
+            order.setTotalRegimentalSettleAmount(jsonObject.getLong("totalRegimentalSettleAmount"));
+            order.setStatDate(DateUtils.tempToLongDate(jsonObject.getLong("orderCreateTime")));
+            orders.add(order);
+        }
+        jiaoYangFenXiaoMapper.replace(orders);
+        if (list.size() >= 200) {
+            getOrderList(cookie, offset + 200, orderCreateTimeStart, orderCreateTimeEnd);
+        }
+
+    }
+
+
+    public static String filterSupplement(String content) {
+        StringBuilder sb = new StringBuilder();
+        for (char ch : content.toCharArray()) {
+            if (!Character.isHighSurrogate(ch) && !Character.isLowSurrogate(ch)) {
+                sb.append(ch);
+            }
+        }
+        return sb.toString();
+    }
+
+}