Browse Source

抖音数据 添加订单数环比

zhaoxian 1 year ago
parent
commit
8f36eae0bc

+ 234 - 80
ruixuan-live/src/main/java/com/ruixuan/bytedance/controller/BytedancePromoterOrderListController.java

@@ -1,7 +1,6 @@
 package com.ruixuan.bytedance.controller;
 
 import com.alibaba.fastjson.JSONObject;
-import com.google.gson.JsonElement;
 import com.ruixuan.bytedance.service.IBytedancePromoterOrderListService;
 import com.ruixuan.common.core.controller.BaseController;
 import com.ruixuan.common.core.page.TableDataInfo;
@@ -54,8 +53,8 @@ public class BytedancePromoterOrderListController extends BaseController {
             String promoterId = jsonObject.getString("promoter_id");
             Long start = jsonObject.getLong("start");
             Long end = jsonObject.getLong("end");
-            BigDecimal bigDecimal1 = bytedancePromoterOrderListService.getCount(promoterId,start,end);
-            if(!Check.isNull(bigDecimal1)){
+            BigDecimal bigDecimal1 = bytedancePromoterOrderListService.getCount(promoterId, start, end);
+            if (!Check.isNull(bigDecimal1)) {
                 bigDecimal = bigDecimal.add(bigDecimal1);
             }
 
@@ -77,13 +76,25 @@ public class BytedancePromoterOrderListController extends BaseController {
                                             @ApiParam("达人ID") @RequestParam(value = "promoterId", required = false) String promoterId) {
 
         Map<String, Object> requestMap = new HashMap<>();
-        if (!Check.isNull(orderStartDate)) {
-            Integer start = DateUtils.getIntegerTime(orderStartDate);
-            requestMap.put("start", start);
-        }
-        if (!Check.isNull(orderEndDate)) {
-            Integer end = DateUtils.getIntegerTime(orderEndDate);
-            requestMap.put("end", end);
+        if (!Check.isNull(orderStartDate) && !Check.isNull(orderEndDate)) {
+            requestMap.put("start", DateUtils.getIntegerTime(orderStartDate));
+            requestMap.put("end", DateUtils.getIntegerTime(orderEndDate));
+
+            //根据本阶段日期 获取上阶段 开始 和 截至 日期
+            Map<String, String> map = DateUtils.getStartEndTime(orderStartDate, orderEndDate);
+            String daysBetween = map.get("daysBetween");
+            //当前小时
+            Integer hour = DateUtils.getNowHour() - 1;
+            //当天 yyyy-MM-dd
+            String today = DateUtils.getNowDateStr();
+            if (!(orderStartDate.equals(orderEndDate) && orderStartDate.equals(today))) {
+                hour = 23;
+            }
+            //下个周期的开始时间
+            requestMap.put("lastTimeStart", DateUtils.getIntegerTime(map.get("lastTimeStart")));
+            //下个周期的结束时间
+            requestMap.put("lastTimeEnd", DateUtils.getIntegerTime(map.get("lastTimeEnd")));
+            requestMap.put("hour", hour);
         }
         if (!Check.isNull(promoterNickName)) {
             requestMap.put("promoterNickName", promoterNickName);
@@ -115,13 +126,25 @@ public class BytedancePromoterOrderListController extends BaseController {
                                     @ApiParam("达人ID") @RequestParam(value = "promoterId", required = false) String promoterId
     ) throws Exception {
         Map<String, Object> requestMap = new HashMap<>();
-        if (!Check.isNull(orderStartDate)) {
-            Integer start = DateUtils.getIntegerTime(orderStartDate);
-            requestMap.put("start", start);
-        }
-        if (!Check.isNull(orderEndDate)) {
-            Integer end = DateUtils.getIntegerTime(orderEndDate);
-            requestMap.put("end", end);
+        if (!Check.isNull(orderStartDate) && !Check.isNull(orderEndDate)) {
+            requestMap.put("start", DateUtils.getIntegerTime(orderStartDate));
+            requestMap.put("end", DateUtils.getIntegerTime(orderEndDate));
+
+            //根据本阶段日期 获取上阶段 开始 和 截至 日期
+            Map<String, String> map = DateUtils.getStartEndTime(orderStartDate, orderEndDate);
+            String daysBetween = map.get("daysBetween");
+            //当前小时
+            Integer hour = DateUtils.getNowHour() - 1;
+            //当天 yyyy-MM-dd
+            String today = DateUtils.getNowDateStr();
+            if (!(orderStartDate.equals(orderEndDate) && orderStartDate.equals(today))) {
+                hour = 23;
+            }
+            //下个周期的开始时间
+            requestMap.put("lastTimeStart", DateUtils.getIntegerTime(map.get("lastTimeStart")));
+            //下个周期的结束时间
+            requestMap.put("lastTimeEnd", DateUtils.getIntegerTime(map.get("lastTimeEnd")));
+            requestMap.put("hour", hour);
         }
         if (!Check.isNull(promoterNickName)) {
             requestMap.put("promoterNickName", promoterNickName);
@@ -137,6 +160,7 @@ public class BytedancePromoterOrderListController extends BaseController {
                 List<Object> export = new ArrayList();
                 export.add(date.getString("promoterNickName") + "(" + date.getString("promoterId") + ")");
                 export.add(date.getInteger("orderNum"));
+                export.add(date.getString("orderNumRatio"));
                 export.add(date.getInteger("validOrderNUm"));
                 export.add(date.getString("validRadio"));
                 export.add(date.getString("payAmount"));
@@ -147,7 +171,7 @@ public class BytedancePromoterOrderListController extends BaseController {
                 exportList.add(export);
             }
         }
-        String[] headers = {"达人名称", "订单数", "有效订单数", "有效订单率", "GVM", "有效GMV", "预估服务费", "二级团预估服务费", "绑定人"};
+        String[] headers = {"达人名称", "订单数", "订单数环比", "有效订单数", "有效订单率", "GVM", "有效GMV", "预估服务费", "二级团预估服务费", "绑定人"};
         OutputStream os = response.getOutputStream();
         ExportExcelUtils eeu = new ExportExcelUtils();
         XSSFWorkbook workbook = new XSSFWorkbook();
@@ -317,25 +341,49 @@ public class BytedancePromoterOrderListController extends BaseController {
 
     ) {
         Map<String, Object> requestMap = new HashMap<>();
-        if (!Check.isNull(orderStartDate)) {
-            Integer start = DateUtils.getIntegerTime(orderStartDate);
-            requestMap.put("start", start);
-        }
-        if (!Check.isNull(orderEndDate)) {
-            Integer end = DateUtils.getIntegerTime(orderEndDate);
-            requestMap.put("end", end);
+        if (!Check.isNull(orderStartDate) && !Check.isNull(orderEndDate)) {
+            requestMap.put("start", DateUtils.getIntegerTime(orderStartDate));
+            requestMap.put("end", DateUtils.getIntegerTime(orderEndDate));
+
+            //根据本阶段日期 获取上阶段 开始 和 截至 日期
+            Map<String, String> map = DateUtils.getStartEndTime(orderStartDate, orderEndDate);
+            String daysBetween = map.get("daysBetween");
+            //当前小时
+            Integer hour = DateUtils.getNowHour() - 1;
+            //当天 yyyy-MM-dd
+            String today = DateUtils.getNowDateStr();
+            if (!(orderStartDate.equals(orderEndDate) && orderStartDate.equals(today))) {
+                hour = 23;
+            }
+            //下个周期的开始时间
+            requestMap.put("lastTimeStart", DateUtils.getIntegerTime(map.get("lastTimeStart")));
+            //下个周期的结束时间
+            requestMap.put("lastTimeEnd", DateUtils.getIntegerTime(map.get("lastTimeEnd")));
+            requestMap.put("hour", hour);
         }
         if (!Check.isNull(collectSampleId)) {
             requestMap.put("collectSampleId", collectSampleId);
         }
 
-        if (!Check.isNull(bindStartDate)) {
-            Integer start = DateUtils.getIntegerTime(bindStartDate);
-            requestMap.put("bindStartDate", start);
-        }
-        if (!Check.isNull(bindEndDate)) {
-            Integer end = DateUtils.getIntegerTime(bindEndDate);
-            requestMap.put("bindEndDate", end);
+        if (!Check.isNull(bindStartDate) && !Check.isNull(bindEndDate)) {
+            requestMap.put("bindStartDate", DateUtils.getIntegerTime(bindStartDate));
+            requestMap.put("bindEndDate", DateUtils.getIntegerTime(bindEndDate));
+
+            //根据本阶段日期 获取上阶段 开始 和 截至 日期
+            Map<String, String> map = DateUtils.getStartEndTime(bindStartDate, bindEndDate);
+            String daysBetween = map.get("daysBetween");
+            //当前小时
+            Integer hour = DateUtils.getNowHour() - 1;
+            //当天 yyyy-MM-dd
+            String today = DateUtils.getNowDateStr();
+            if (!(bindStartDate.equals(bindEndDate) && bindStartDate.equals(today))) {
+                hour = 23;
+            }
+            //下个周期的开始时间
+            requestMap.put("lastTimeStart", DateUtils.getIntegerTime(map.get("lastTimeStart")));
+            //下个周期的结束时间
+            requestMap.put("lastTimeEnd", DateUtils.getIntegerTime(map.get("lastTimeEnd")));
+            requestMap.put("hour", hour);
         }
 
         TableDataInfo dataInfo = new TableDataInfo();
@@ -368,24 +416,47 @@ public class BytedancePromoterOrderListController extends BaseController {
                                    @ApiParam("结束时间") @RequestParam(value = "bindEndDate", required = false) String bindEndDate,
                                    @ApiParam("用户ID") @RequestParam(value = "collectSampleId", required = false) Long collectSampleId) throws IOException {
         Map<String, Object> requestMap = new HashMap<>();
-        if (!Check.isNull(orderStartDate)) {
-            Integer start = DateUtils.getIntegerTime(orderStartDate);
-            requestMap.put("start", start);
-        }
-        if (!Check.isNull(orderEndDate)) {
-            Integer end = DateUtils.getIntegerTime(orderEndDate);
-            requestMap.put("end", end);
+        if (!Check.isNull(orderStartDate) && !Check.isNull(orderEndDate)) {
+            requestMap.put("start", DateUtils.getIntegerTime(orderStartDate));
+            requestMap.put("end", DateUtils.getIntegerTime(orderEndDate));
+
+            //根据本阶段日期 获取上阶段 开始 和 截至 日期
+            Map<String, String> map = DateUtils.getStartEndTime(orderStartDate, orderEndDate);
+            String daysBetween = map.get("daysBetween");
+            //当前小时
+            Integer hour = DateUtils.getNowHour() - 1;
+            //当天 yyyy-MM-dd
+            String today = DateUtils.getNowDateStr();
+            if (!(orderStartDate.equals(orderEndDate) && orderStartDate.equals(today))) {
+                hour = 23;
+            }
+            //下个周期的开始时间
+            requestMap.put("lastTimeStart", DateUtils.getIntegerTime(map.get("lastTimeStart")));
+            //下个周期的结束时间
+            requestMap.put("lastTimeEnd", DateUtils.getIntegerTime(map.get("lastTimeEnd")));
+            requestMap.put("hour", hour);
         }
 
-        if (!Check.isNull(bindStartDate)) {
-            Integer start = DateUtils.getIntegerTime(bindStartDate);
-            requestMap.put("bindStartDate", start);
-        }
-        if (!Check.isNull(bindEndDate)) {
-            Integer end = DateUtils.getIntegerTime(bindEndDate);
-            requestMap.put("bindEndDate", end);
+        if (!Check.isNull(bindStartDate) && !Check.isNull(bindEndDate)) {
+            requestMap.put("bindStartDate", DateUtils.getIntegerTime(bindStartDate));
+            requestMap.put("bindEndDate", DateUtils.getIntegerTime(bindEndDate));
+
+            //根据本阶段日期 获取上阶段 开始 和 截至 日期
+            Map<String, String> map = DateUtils.getStartEndTime(bindStartDate, bindEndDate);
+            String daysBetween = map.get("daysBetween");
+            //当前小时
+            Integer hour = DateUtils.getNowHour() - 1;
+            //当天 yyyy-MM-dd
+            String today = DateUtils.getNowDateStr();
+            if (!(bindStartDate.equals(bindEndDate) && bindStartDate.equals(today))) {
+                hour = 23;
+            }
+            //下个周期的开始时间
+            requestMap.put("lastTimeStart", DateUtils.getIntegerTime(map.get("lastTimeStart")));
+            //下个周期的结束时间
+            requestMap.put("lastTimeEnd", DateUtils.getIntegerTime(map.get("lastTimeEnd")));
+            requestMap.put("hour", hour);
         }
-
         if (!Check.isNull(collectSampleId)) {
             requestMap.put("collectSampleId", collectSampleId);
         }
@@ -416,6 +487,7 @@ public class BytedancePromoterOrderListController extends BaseController {
                 export.add(date.getString("sendPromoterCount"));
                 export.add(date.getString("sendItemCount"));
                 export.add(date.getString("orderNum"));
+                export.add(date.getString("orderNumRatio"));
                 export.add(date.getString("validOrderNum"));
                 export.add(date.getString("validOrderRate"));
                 export.add(date.getString("orderAmount"));
@@ -425,7 +497,7 @@ public class BytedancePromoterOrderListController extends BaseController {
                 exportList.add(export);
             }
         }
-        String[] headers = {"渠道ID", "渠道姓名", "(总)达人数", "(总)领样达人数", "(总)领样率", "(总)未领样数", "发样数", "发样达人数", "发样商品数", "订单数", "有效订单数", "有效订单率", "订单金额", "预估服务费", "结算服务费", "服务费支出"};
+        String[] headers = {"渠道ID", "渠道姓名", "(总)达人数", "(总)领样达人数", "(总)领样率", "(总)未领样数", "发样数", "发样达人数", "发样商品数", "订单数", "订单数环比", "有效订单数", "有效订单率", "订单金额", "预估服务费", "结算服务费", "服务费支出"};
         OutputStream os = response.getOutputStream();
         ExportExcelUtils eeu = new ExportExcelUtils();
         XSSFWorkbook workbook = new XSSFWorkbook();
@@ -582,13 +654,25 @@ public class BytedancePromoterOrderListController extends BaseController {
 
     ) {
         Map<String, Object> requestMap = new HashMap<>();
-        if (!Check.isNull(orderStartDate)) {
-            Integer start = DateUtils.getIntegerTime(orderStartDate);
-            requestMap.put("start", start);
-        }
-        if (!Check.isNull(orderEndDate)) {
-            Integer end = DateUtils.getIntegerTime(orderEndDate);
-            requestMap.put("end", end);
+        if (!Check.isNull(orderStartDate) && !Check.isNull(orderEndDate)) {
+            requestMap.put("start", DateUtils.getIntegerTime(orderStartDate));
+            requestMap.put("end", DateUtils.getIntegerTime(orderEndDate));
+
+            //根据本阶段日期 获取上阶段 开始 和 截至 日期
+            Map<String, String> map = DateUtils.getStartEndTime(orderStartDate, orderEndDate);
+            String daysBetween = map.get("daysBetween");
+            //当前小时
+            Integer hour = DateUtils.getNowHour() - 1;
+            //当天 yyyy-MM-dd
+            String today = DateUtils.getNowDateStr();
+            if (!(orderStartDate.equals(orderEndDate) && orderStartDate.equals(today))) {
+                hour = 23;
+            }
+            //下个周期的开始时间
+            requestMap.put("lastTimeStart", DateUtils.getIntegerTime(map.get("lastTimeStart")));
+            //下个周期的结束时间
+            requestMap.put("lastTimeEnd", DateUtils.getIntegerTime(map.get("lastTimeEnd")));
+            requestMap.put("hour", hour);
         }
         if (!Check.isNull(itemId)) {
             requestMap.put("itemId", itemId);
@@ -628,13 +712,25 @@ public class BytedancePromoterOrderListController extends BaseController {
             @ApiParam("结束时间") @RequestParam(value = "orderEndDate", required = false) String orderEndDate,
             @ApiParam("用户ID") @RequestParam(value = "userId", required = false) String userId) throws IOException {
         Map<String, Object> requestMap = new HashMap<>();
-        if (!Check.isNull(orderStartDate)) {
-            Integer start = DateUtils.getIntegerTime(orderStartDate);
-            requestMap.put("start", start);
-        }
-        if (!Check.isNull(orderEndDate)) {
-            Integer end = DateUtils.getIntegerTime(orderEndDate);
-            requestMap.put("end", end);
+        if (!Check.isNull(orderStartDate) && !Check.isNull(orderEndDate)) {
+            requestMap.put("start", DateUtils.getIntegerTime(orderStartDate));
+            requestMap.put("end", DateUtils.getIntegerTime(orderEndDate));
+
+            //根据本阶段日期 获取上阶段 开始 和 截至 日期
+            Map<String, String> map = DateUtils.getStartEndTime(orderStartDate, orderEndDate);
+            String daysBetween = map.get("daysBetween");
+            //当前小时
+            Integer hour = DateUtils.getNowHour() - 1;
+            //当天 yyyy-MM-dd
+            String today = DateUtils.getNowDateStr();
+            if (!(orderStartDate.equals(orderEndDate) && orderStartDate.equals(today))) {
+                hour = 23;
+            }
+            //下个周期的开始时间
+            requestMap.put("lastTimeStart", DateUtils.getIntegerTime(map.get("lastTimeStart")));
+            //下个周期的结束时间
+            requestMap.put("lastTimeEnd", DateUtils.getIntegerTime(map.get("lastTimeEnd")));
+            requestMap.put("hour", hour);
         }
         if (!Check.isNull(itemId)) {
             requestMap.put("itemId", itemId);
@@ -665,6 +761,7 @@ public class BytedancePromoterOrderListController extends BaseController {
                 export.add(date.getString("imageUrl"));
                 export.add(date.getString("itemCommissionRate"));
                 export.add(date.getInteger("orderNum"));
+                export.add(date.getString("orderNumRatio"));
                 export.add(date.getInteger("validOrderNUm"));
                 export.add(date.getString("validRadio"));
                 export.add(date.getString("regimentalPromotionAmount"));
@@ -672,7 +769,7 @@ public class BytedancePromoterOrderListController extends BaseController {
                 exportList.add(export);
             }
         }
-        String[] headers = {"所属人", "商品ID", "商品名称", "商品封面", "佣金率", "订单数", "有效订单数", "有效订单率", "预估服务费", "二级团长预估服务费"};
+        String[] headers = {"所属人", "商品ID", "商品名称", "商品封面", "佣金率", "订单数", "订单数环比", "有效订单数", "有效订单率", "预估服务费", "二级团长预估服务费"};
         OutputStream os = response.getOutputStream();
         ExportExcelUtils eeu = new ExportExcelUtils();
         XSSFWorkbook workbook = new XSSFWorkbook();
@@ -833,17 +930,45 @@ public class BytedancePromoterOrderListController extends BaseController {
     ) {
         Map<String, Object> requestMap = new HashMap<>();
         if (!Check.isNull(orderStartDate) && !Check.isNull(orderEndDate)) {
-            Integer start = DateUtils.getIntegerTime(orderStartDate);
-            requestMap.put("start", start);
-            Integer end = DateUtils.getIntegerTime(orderEndDate);
-            requestMap.put("end", end);
+            requestMap.put("start", DateUtils.getIntegerTime(orderStartDate));
+            requestMap.put("end", DateUtils.getIntegerTime(orderEndDate));
+
+            //根据本阶段日期 获取上阶段 开始 和 截至 日期
+            Map<String, String> map = DateUtils.getStartEndTime(orderStartDate, orderEndDate);
+            String daysBetween = map.get("daysBetween");
+            //当前小时
+            Integer hour = DateUtils.getNowHour() - 1;
+            //当天 yyyy-MM-dd
+            String today = DateUtils.getNowDateStr();
+            if (!(orderStartDate.equals(orderEndDate) && orderStartDate.equals(today))) {
+                hour = 23;
+            }
+            //下个周期的开始时间
+            requestMap.put("lastTimeStart", DateUtils.getIntegerTime(map.get("lastTimeStart")));
+            //下个周期的结束时间
+            requestMap.put("lastTimeEnd", DateUtils.getIntegerTime(map.get("lastTimeEnd")));
+            requestMap.put("hour", hour);
         }
 
         if (!Check.isNull(bindStartDate) && !Check.isNull(bindEndDate)) {
-            Integer start = DateUtils.getIntegerTime(bindStartDate);
-            requestMap.put("start", start);
-            Integer end = DateUtils.getIntegerTime(bindEndDate);
-            requestMap.put("end", end);
+            requestMap.put("start", DateUtils.getIntegerTime(bindStartDate));
+            requestMap.put("end", DateUtils.getIntegerTime(bindEndDate));
+
+            //根据本阶段日期 获取上阶段 开始 和 截至 日期
+            Map<String, String> map = DateUtils.getStartEndTime(bindStartDate, bindEndDate);
+            String daysBetween = map.get("daysBetween");
+            //当前小时
+            Integer hour = DateUtils.getNowHour() - 1;
+            //当天 yyyy-MM-dd
+            String today = DateUtils.getNowDateStr();
+            if (!(bindStartDate.equals(bindEndDate) && bindStartDate.equals(today))) {
+                hour = 23;
+            }
+            //下个周期的开始时间
+            requestMap.put("lastTimeStart", DateUtils.getIntegerTime(map.get("lastTimeStart")));
+            //下个周期的结束时间
+            requestMap.put("lastTimeEnd", DateUtils.getIntegerTime(map.get("lastTimeEnd")));
+            requestMap.put("hour", hour);
         }
 
         if (!Check.isNull(userId)) {
@@ -885,17 +1010,45 @@ public class BytedancePromoterOrderListController extends BaseController {
     ) throws IOException {
         Map<String, Object> requestMap = new HashMap<>();
         if (!Check.isNull(orderStartDate) && !Check.isNull(orderEndDate)) {
-            Integer start = DateUtils.getIntegerTime(orderStartDate);
-            requestMap.put("start", start);
-            Integer end = DateUtils.getIntegerTime(orderEndDate);
-            requestMap.put("end", end);
+            requestMap.put("start", DateUtils.getIntegerTime(orderStartDate));
+            requestMap.put("end", DateUtils.getIntegerTime(orderEndDate));
+
+            //根据本阶段日期 获取上阶段 开始 和 截至 日期
+            Map<String, String> map = DateUtils.getStartEndTime(orderStartDate, orderEndDate);
+            String daysBetween = map.get("daysBetween");
+            //当前小时
+            Integer hour = DateUtils.getNowHour() - 1;
+            //当天 yyyy-MM-dd
+            String today = DateUtils.getNowDateStr();
+            if (!(orderStartDate.equals(orderEndDate) && orderStartDate.equals(today))) {
+                hour = 23;
+            }
+            //下个周期的开始时间
+            requestMap.put("lastTimeStart", DateUtils.getIntegerTime(map.get("lastTimeStart")));
+            //下个周期的结束时间
+            requestMap.put("lastTimeEnd", DateUtils.getIntegerTime(map.get("lastTimeEnd")));
+            requestMap.put("hour", hour);
         }
 
         if (!Check.isNull(bindStartDate) && !Check.isNull(bindEndDate)) {
-            Integer start = DateUtils.getIntegerTime(bindStartDate);
-            requestMap.put("start", start);
-            Integer end = DateUtils.getIntegerTime(bindEndDate);
-            requestMap.put("end", end);
+            requestMap.put("start", DateUtils.getIntegerTime(bindStartDate));
+            requestMap.put("end", DateUtils.getIntegerTime(bindEndDate));
+
+            //根据本阶段日期 获取上阶段 开始 和 截至 日期
+            Map<String, String> map = DateUtils.getStartEndTime(bindStartDate, bindEndDate);
+            String daysBetween = map.get("daysBetween");
+            //当前小时
+            Integer hour = DateUtils.getNowHour() - 1;
+            //当天 yyyy-MM-dd
+            String today = DateUtils.getNowDateStr();
+            if (!(bindStartDate.equals(bindEndDate) && bindStartDate.equals(today))) {
+                hour = 23;
+            }
+            //下个周期的开始时间
+            requestMap.put("lastTimeStart", DateUtils.getIntegerTime(map.get("lastTimeStart")));
+            //下个周期的结束时间
+            requestMap.put("lastTimeEnd", DateUtils.getIntegerTime(map.get("lastTimeEnd")));
+            requestMap.put("hour", hour);
         }
 
         if (!Check.isNull(userId)) {
@@ -918,6 +1071,7 @@ public class BytedancePromoterOrderListController extends BaseController {
                 export.add(date.getString("itemCount"));
                 export.add(date.getString("sendSampleCount"));
                 export.add(date.getString("orderNum"));
+                export.add(date.getString("orderNumRatio"));
                 export.add(date.getString("validOrderNUm"));
                 export.add(date.getString("validRadio"));
                 export.add(date.getString("payAmount"));
@@ -927,7 +1081,7 @@ public class BytedancePromoterOrderListController extends BaseController {
                 exportList.add(export);
             }
         }
-        String[] headers = {"招商", "商品数", "发样数", "订单数", "有效订单数", "有效率", "实付金额", "预估服务费收入", "结算服务费收入", "服务费支出"};
+        String[] headers = {"招商", "商品数", "发样数", "订单数", "订单数环比", "有效订单数", "有效率", "实付金额", "预估服务费收入", "结算服务费收入", "服务费支出"};
         OutputStream os = response.getOutputStream();
         ExportExcelUtils eeu = new ExportExcelUtils();
         XSSFWorkbook workbook = new XSSFWorkbook();

+ 314 - 106
ruixuan-live/src/main/resources/mapper/bytedance/JiaoYangCallbackMapper.xml

@@ -170,48 +170,81 @@
 
 
     <select id="getBytedanceOrderList" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT *
+        SELECT
+        t.*,
+        ROUND(((t.orderNum-t2.orderNum)/t2.orderNum)*100,2) as 'orderNumRatio'
         FROM (
         SELECT
-        IFNULL(author_short_id,'-') AS 'promoterId',
-        IFNULL(author_short_name,'-') AS 'promoterNickName',
-        count( order_id ) AS 'orderNum',
-        sum( CASE WHEN flow_point != 'REFUND' THEN 1 ELSE 0 END ) AS 'validOrderNUm',
-        CONCAT(round( sum( CASE WHEN flow_point != 'REFUND' THEN 1 ELSE 0 END ) / count( order_id )*100, 2 ),'%') AS
+        IFNULL(t1.author_short_id,'-') AS 'promoterId',
+        IFNULL(t1.author_short_name,'-') AS 'promoterNickName',
+        count( t1.order_id ) AS 'orderNum',
+        sum( CASE WHEN t1.flow_point != 'REFUND' THEN 1 ELSE 0 END ) AS 'validOrderNUm',
+        CONCAT(round( sum( CASE WHEN t1.flow_point != 'REFUND' THEN 1 ELSE 0 END ) / count( t1.order_id )*100, 2 ),'%')
+        AS
         'validRadio',
-        sum( total_pay_amount )/100 AS 'payAmount',
-        sum( CASE WHEN flow_point != 'REFUND' THEN total_pay_amount ELSE 0 END )/100 AS 'validPayAmount',
+        sum( t1.total_pay_amount )/100 AS 'payAmount',
+        sum( CASE WHEN t1.flow_point != 'REFUND' THEN t1.total_pay_amount ELSE 0 END )/100 AS 'validPayAmount',
         sum(CASE
-        WHEN flow_point != 'REFUND' and colonel_type != 2
-        THEN colonel_estimated_commission
-        WHEN flow_point != 'REFUND' and colonel_type = 2
-        then second_estimated_commission
-        ELSE 0 END) * 0.9 / 100                                                                        AS
+        WHEN t1.flow_point != 'REFUND' and t1.colonel_type != 2
+        THEN t1.colonel_estimated_commission
+        WHEN t1.flow_point != 'REFUND' and t1.colonel_type = 2
+        then t1.second_estimated_commission
+        ELSE 0 END) * 0.9 / 100 AS
         'regimentalPromotionAmount',
         sum(CASE
-        WHEN flow_point != 'REFUND' and colonel_type != 2
-        THEN second_estimated_commission
-        ELSE 0 END) / 100                                                                                                    AS 'secondEstimatedCommission',
-
-        author_bind_user_id,
-        IFNULL(author_bind_user_name,'-') AS 'userName'
+        WHEN t1.flow_point != 'REFUND' and t1.colonel_type != 2
+        THEN t1.second_estimated_commission
+        ELSE 0 END) / 100 AS 'secondEstimatedCommission',
+        t1.author_bind_user_id,
+        IFNULL(t1.author_bind_user_name,'-') AS 'userName'
         FROM
-        bytedance_promoter_order_list
-        WHERE
-        1 = 1
-        <if test="start != null and start != ''">
-            and pay_success_time &gt;= #{start}
-        </if>
-        <if test="end != null and end != ''">
-            and pay_success_time &lt;= #{end}
-        </if>
-        <if test="promoterId != null and promoterId != ''">
-            and author_short_id = #{promoterId}
-        </if>
-        <if test="promoterNickName != null and promoterNickName != ''">
-            and author_short_name like CONCAT(CONCAT('%',#{promoterNickName}),'%')
-        </if>
-        GROUP BY author_short_id) t
+        bytedance_promoter_order_list t1 LEFT JOIN
+        bytedance_order_list t2 ON t1.order_id = t2.order_id
+        <where>
+            <if test="hour != null and hour != ''">
+                and t2.pay_success_time_hour &lt;= #{hour}
+            </if>
+            <if test="start != null and start != ''">
+                and t2.pay_success_time &gt;= #{start}
+            </if>
+            <if test="end != null and end != ''">
+                and t2.pay_success_time &lt;= #{end}
+            </if>
+            <if test="promoterId != null and promoterId != ''">
+                and t1.author_short_id = #{promoterId}
+            </if>
+            <if test="promoterNickName != null and promoterNickName != ''">
+                and t1.author_short_name like CONCAT(CONCAT('%',#{promoterNickName}),'%')
+            </if>
+        </where>
+        GROUP BY t1.author_short_id
+        ) t
+        LEFT JOIN (
+        SELECT
+        IFNULL(t1.author_short_id,'-') AS 'promoterId',
+        count( t1.order_id ) AS 'orderNum'
+        FROM
+        bytedance_promoter_order_list t1 LEFT JOIN
+        bytedance_order_list t2 ON t1.order_id = t2.order_id
+        <where>
+            <if test="hour != null and hour != ''">
+                and t2.pay_success_time_hour &lt;= #{hour}
+            </if>
+            <if test="lastTimeStart != null and lastTimeStart != ''">
+                and t2.pay_success_time &gt;= #{lastTimeStart}
+            </if>
+            <if test="lastTimeEnd != null and lastTimeEnd != ''">
+                and t2.pay_success_time &lt;= #{lastTimeEnd}
+            </if>
+            <if test="promoterId != null and promoterId != ''">
+                and t1.author_short_id = #{promoterId}
+            </if>
+            <if test="promoterNickName != null and promoterNickName != ''">
+                and t1.author_short_name like CONCAT(CONCAT('%',#{promoterNickName}),'%')
+            </if>
+        </where>
+        GROUP BY t1.author_short_id
+        ) t2 on t.promoterId = t2.promoterId
         ORDER BY t.orderNum desc
     </select>
 
@@ -400,6 +433,10 @@
 
     <select id="bytedanceItemList" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
+        t.*,
+        ROUND(((t.orderNum-t2.orderNum)/t2.orderNum)*100,2) as 'orderNumRatio'
+        FROM (
+        SELECT
         t1.product_bind_user_id AS 'userId',
         t1.product_bind_user_name AS 'userName',
         t1.product_id AS 'itemId',
@@ -411,40 +448,75 @@
         CONCAT(round(sum(case when t1.flow_point != 'REFUND' then 1 else 0 end) / count(t1.order_id)*100, 2),'%') as
         'validRadio',
         CONCAT(Round(t1.commission_rate/100,2),'%') AS 'itemCommissionRate',
-        sum(CASE
-        WHEN flow_point != 'REFUND' and colonel_type != 2
-        THEN colonel_estimated_commission
-        WHEN flow_point != 'REFUND' and colonel_type = 2
-        then second_estimated_commission
-        ELSE 0 END) * 0.9 / 100 AS
-        'regimentalPromotionAmount',
-        sum(CASE
-        WHEN flow_point != 'REFUND' and colonel_type != 2 THEN second_estimated_commission
-        ELSE 0 END) /
-        100 AS 'secondEstimatedCommission'
+        SUM(CASE
+        WHEN t1.flow_point != 'REFUND' and t1.colonel_type != 2
+        THEN t1.colonel_estimated_commission
+        WHEN t1.flow_point != 'REFUND' and t1.colonel_type = 2
+        then t1.second_estimated_commission
+        ELSE 0 END) * 0.9 / 100 AS 'regimentalPromotionAmount',
+        SUM(CASE
+        WHEN t1.flow_point != 'REFUND' and t1.colonel_type != 2 THEN t1.second_estimated_commission
+        ELSE 0 END) / 100 AS 'secondEstimatedCommission'
         FROM bytedance_promoter_order_list t1
-        WHERE 1 = 1
-        <if test="start != null and start != ''">
-            and t1.pay_success_time &gt;= #{start}
-        </if>
-        <if test="end != null and end != ''">
-            and t1.pay_success_time &lt;= #{end}
-        </if>
-        <if test="itemId != null and itemId != ''">
-            and t1.product_id = #{itemId}
-        </if>
-        <if test="itemTitle != null and itemTitle != ''">
-            and t1.product_name like CONCAT(CONCAT('%',#{itemTitle}),'%')
-        </if>
-        <if test="userId != null and userId != ''">
-            and t1.product_bind_user_id = #{userId}
-        </if>
+        LEFT JOIN bytedance_order_list t2 ON t1.order_id = t2.order_id
+        <where>
+            <if test="hour != null and hour != ''">
+                and t2.pay_success_time_hour &lt;= #{hour}
+            </if>
+            <if test="start != null and start != ''">
+                and t2.pay_success_time &gt;= #{start}
+            </if>
+            <if test="end != null and end != ''">
+                and t2.pay_success_time &lt;= #{end}
+            </if>
+            <if test="itemId != null and itemId != ''">
+                and t1.product_id = #{itemId}
+            </if>
+            <if test="itemTitle != null and itemTitle != ''">
+                and t1.product_name like CONCAT(CONCAT('%',#{itemTitle}),'%')
+            </if>
+            <if test="userId != null and userId != ''">
+                and t1.product_bind_user_id = #{userId}
+            </if>
+        </where>
+        GROUP BY t1.product_id
+        ) t
+        LEFT JOIN(
+        SELECT
+        t1.product_id AS 'itemId',
+        count(t1.order_id) AS 'orderNum'
+        FROM bytedance_promoter_order_list t1
+        LEFT JOIN bytedance_order_list t2 ON t1.order_id = t2.order_id
+        <where>
+            <if test="hour != null and hour != ''">
+                and t2.pay_success_time_hour &lt;= #{hour}
+            </if>
+            <if test="lastTimeStart != null and lastTimeStart != ''">
+                and t2.pay_success_time &gt;= #{lastTimeStart}
+            </if>
+            <if test="lastTimeEnd != null and lastTimeEnd != ''">
+                and t2.pay_success_time &lt;= #{lastTimeEnd}
+            </if>
+            <if test="itemId != null and itemId != ''">
+                and t1.product_id = #{itemId}
+            </if>
+            <if test="itemTitle != null and itemTitle != ''">
+                and t1.product_name like CONCAT(CONCAT('%',#{itemTitle}),'%')
+            </if>
+            <if test="userId != null and userId != ''">
+                and t1.product_bind_user_id = #{userId}
+            </if>
+        </where>
         GROUP BY t1.product_id
-        ORDER BY ${fieId} ${sort}
+        ) t2 ON t.itemId = t2.itemId
+        ORDER BY t.${fieId} ${sort}
     </select>
 
     <select id="adminBytedanceReportList" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT *
+        SELECT
+        t.*,
+        t1.sendSampleCount,
+        ROUND(((t.orderNum-t2.orderNum)/t2.orderNum)*100,2) as 'orderNumRatio'
         FROM (
         SELECT
         t2.product_bind_user_id AS 'userId',
@@ -470,30 +542,57 @@
         sum(case when t2.flow_point != 'REFUND' then t2.colonel_real_commission else 0 end)/100 as
         'totalRegimentalSettleAmount'
         FROM bytedance_promoter_order_list t2
+        LEFT JOIN bytedance_order_list t3 ON t3.order_id = t2.order_id
         WHERE product_bind_user_id is not null
+        <if test="hour != null and hour != ''">
+            and t3.pay_success_time_hour &lt;= #{hour}
+        </if>
         <if test="start != null and start != ''">
-            and t2.pay_success_time &gt;= #{start}
+            and t3.pay_success_time &gt;= #{start}
         </if>
         <if test="end != null and end != ''">
-            and t2.pay_success_time &lt;= #{end}
+            and t3.pay_success_time &lt;= #{end}
         </if>
-        GROUP BY t2.product_bind_user_id) t
-        LEFT JOIN
-        (
+        GROUP BY t2.product_bind_user_id
+        ) t
+        LEFT JOIN(
         SELECT item_create_id,count(1) AS 'sendSampleCount' FROM kuaishou_item_collect_samples
         WHERE courier_number_time >= CONCAT(#{start},' 00:00:00')
         and courier_number_time &lt;= CONCAT(#{end},' 23:59:59')
         GROUP BY item_create_id
         ) t1 on t.userId = t1.item_create_id
-        WHERE 1 =1
-        <if test="userId != null and userId != ''">
-            and t.userId = #{userId}
+        LEFT JOIN(
+        SELECT
+        t2.product_bind_user_id,
+        count(t2.order_id) AS 'orderNum'
+        FROM bytedance_promoter_order_list t2
+        LEFT JOIN bytedance_order_list t3 ON t3.order_id = t2.order_id
+        WHERE product_bind_user_id is not null
+        <if test="hour != null and hour != ''">
+            and t3.pay_success_time_hour &lt;= #{hour}
+        </if>
+        <if test="lastTimeStart != null and lastTimeStart != ''">
+            and t3.pay_success_time &gt;= #{lastTimeStart}
+        </if>
+        <if test="lastTimeEnd != null and lastTimeEnd != ''">
+            and t3.pay_success_time &lt;= #{lastTimeEnd}
         </if>
+        GROUP BY t2.product_bind_user_id
+        ) t2 on t.userId = t2.product_bind_user_id
+        <where>
+            <if test="userId != null and userId != ''">
+                and t.userId = #{userId}
+            </if>
+        </where>
         ORDER BY t.orderNum desc
     </select>
 
     <select id="adminBytedanceReportListByBind" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT * FROM (
+        SELECT
+        t.*,
+        t2.sendSampleCount,
+        ROUND(((t.orderNum-t3.orderNum)/t3.orderNum)*100,2) as 'orderNumRatio'
+        FROM (
         SELECT
         t1.user_id AS 'userId',
         t1.user_name AS 'userName',
@@ -518,37 +617,72 @@
         sum(case when t2.flow_point != 'REFUND' then t2.colonel_real_commission else 0 end) / 100 as
         'totalRegimentalSettleAmount'
         FROM (select * from kuaishou_item_list where create_time >= CONCAT(date_format(#{start},'%Y-%m-%d'),' 00:00:00')
-        and create_time &lt;= CONCAT(date_format(#{start},'%Y-%m-%d'),' 23:59:59')
+        and create_time &lt;= CONCAT(date_format(#{end},'%Y-%m-%d'),' 23:59:59')
         and media_id = 1
         ) t1
-        LEFT JOIN (SELECT product_id,
-        order_id,
-        flow_point,
-        total_pay_amount,
-        colonel_estimated_commission,
-        colonel_real_commission,
-        colonel_type,
-        second_estimated_commission
-        FROM bytedance_promoter_order_list
-        WHERE pay_success_time &gt;= #{start}
+        LEFT JOIN (
+        SELECT
+        t1.product_id,
+        t1.order_id,
+        t1.flow_point,
+        t1.total_pay_amount,
+        t1.colonel_estimated_commission,
+        t1.colonel_real_commission,
+        t1.colonel_type,
+        t1.second_estimated_commission
+        FROM bytedance_promoter_order_list t1
+        LEFT JOIN bytedance_order_list t2 ON t1.order_id = t2.order_id
+        WHERE t2.pay_success_time &gt;= #{start}
+        <if test="hour != null and hour != ''">
+            and t2.pay_success_time_hour &lt;= #{hour}
+        </if>
         ) t2
         on t1.item_id = t2.product_id
-
         <if test="userId != null and userId != ''">
             and t1.userId = #{userId}
         </if>
-        GROUP BY t1.user_id ) t LEFT JOIN (
-        SELECT t1.user_id,count(distinct courier_number) AS 'sendSampleCount' FROM kuaishou_item_list t1 LEFT JOIN
-        kuaishou_item_collect_samples t2
-        on t1.item_id = t2.item_id
+        GROUP BY t1.user_id
+        ) t
+        LEFT JOIN (
+        SELECT t1.user_id,count(distinct courier_number) AS 'sendSampleCount'
+        FROM kuaishou_item_list t1
+        LEFT JOIN kuaishou_item_collect_samples t2 ON t1.item_id = t2.item_id
         WHERE t1.create_time >=CONCAT(date_format(#{start},'%Y-%m-%d'),' 00:00:00')
-        and t1.create_time &lt;= CONCAT(date_format(#{start},'%Y-%m-%d'),' 23:59:59')
+        and t1.create_time &lt;= CONCAT(date_format(#{end},'%Y-%m-%d'),' 23:59:59')
         and t2.courier_number_time >= CONCAT(date_format(#{start},'%Y-%m-%d'),' 00:00:00')
         GROUP BY t1.user_id
-        ) t2 on t.userId = t2.user_id ORDER BY t.orderNum desc
+        ) t2 on t.userId = t2.user_id
+        LEFT JOIN (
+        SELECT
+        t1.user_id,
+        count(t2.order_id) AS 'orderNum'
+        FROM (
+        select item_id,user_id
+        from kuaishou_item_list
+        where create_time >= CONCAT(date_format(#{lastTimeStart},'%Y-%m-%d'),' 00:00:00')
+        and create_time &lt;= CONCAT(date_format(#{lastTimeEnd},'%Y-%m-%d'),' 23:59:59')
+        and media_id = 1
+        ) t1
+        LEFT JOIN (
+        SELECT
+        t1.product_id,
+        t1.order_id
+        FROM bytedance_promoter_order_list t1
+        LEFT JOIN bytedance_order_list t2 ON t1.order_id = t2.order_id
+        WHERE t2.pay_success_time &gt;= #{lastTimeStart}
+        AND t2.pay_success_time &lt;= #{lastTimeEnd}
+        <if test="hour != null and hour != ''">
+            and t2.pay_success_time_hour &lt;= #{hour}
+        </if>
+        ) t2 ON t1.item_id = t2.product_id
+        <if test="userId != null and userId != ''">
+            and t1.userId = #{userId}
+        </if>
+        GROUP BY t1.user_id
+        ) t3 ON t.userId = t3.user_id
+        ORDER BY t.orderNum desc
     </select>
 
-
     <select id="getBytedanceTopPromoterByItemId" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
         *
@@ -813,6 +947,7 @@
         tttt.sendTotalCount,
         tttt.sendPromoterCount,
         tttt.sendItemCount,
+        ROUND(((t.orderNum-t11.orderNum)/t11.orderNum)*100,2) as 'orderNumRatio',
         IFNULL( ttttt.promoters_count,'-') as 'promotersCount',
         concat(round(ttt.sampleCount / tt.promoterCount * 100, 2), '%') as 'sampleRate',
         tt.promoterCount - ttt.sampleCount as 'notSampleCount'
@@ -850,18 +985,59 @@
             and user_id = #{collectSampleId}
         </if>
         ) t1
-        left join (select *
+        left join (
+        select *
         from bytedance_order_list
-        where 1 = 1
-        <if test="start != null and start != ''">
-            and pay_success_time &gt;= #{start}
-        </if>
-        <if test="end != null and end != ''">
-            and pay_success_time &lt;= #{end}
-        </if>
+        <where>
+            <if test="hour != null and hour != ''">
+                and pay_success_time_hour &lt;= #{hour}
+            </if>
+            <if test="start != null and start != ''">
+                and pay_success_time &gt;= #{start}
+            </if>
+            <if test="end != null and end != ''">
+                and pay_success_time &lt;= #{end}
+            </if>
+        </where>
         ) t2
         on t1.promoter_id = t2.author_short_id and t1.stat_date = t2.pay_success_time
-        group by t1.user_id) t
+        group by t1.user_id
+        ) t
+        LEFT JOIN (
+        select t1.user_id,
+        count(t2.order_id) as 'orderNum'
+        from (select user_id, promoter_id, stat_date
+        from promoter_bind_channel_date
+        where media_id = 1
+        <if test="lastTimeStart != null and lastTimeStart != ''">
+            and stat_date &gt;= #{lastTimeStart}
+        </if>
+        <if test="lastTimeEnd != null and lastTimeEnd != ''">
+            and stat_date &lt;= #{lastTimeEnd}
+        </if>
+        <if test="collectSampleId != null and collectSampleId != ''">
+            and user_id = #{collectSampleId}
+        </if>
+        ) t1
+        left join (
+        select author_short_id,
+        order_id,
+        pay_success_time
+        from bytedance_order_list
+        <where>
+            <if test="hour != null and hour != ''">
+                and pay_success_time_hour &lt;= #{hour}
+            </if>
+            <if test="lastTimeStart != null and lastTimeStart != ''">
+                and pay_success_time &gt;= #{lastTimeStart}
+            </if>
+            <if test="lastTimeEnd != null and lastTimeEnd != ''">
+                and pay_success_time &lt;= #{lastTimeEnd}
+            </if>
+        </where>
+        ) t2 ON t1.promoter_id = t2.author_short_id and t1.stat_date = t2.pay_success_time
+        group by t1.user_id
+        ) t11 ON t11.user_id = t.collectSampleId
         left join (select user_id,
         count(distinct promoter_id) as 'promoterCount'
         from kuaishou_promoter
@@ -902,6 +1078,7 @@
         tttt.sendTotalCount,
         tttt.sendPromoterCount,
         tttt.sendItemCount,
+        ROUND(((t.orderNum-t11.orderNum)/t11.orderNum)*100,2) as 'orderNumRatio',
         IFNULL(ttttt.promoters_count, '-') as 'promotersCount'
         from (select t1.user_id as 'collectSampleId',
         t1.user_name as 'collectSampleName',
@@ -923,10 +1100,14 @@
         ELSE 0 END) / 100 AS 'secondEstimatedCommission',
         round(sum(t2.colonel_real_commission) / 100, 2) as 'totalRegimentalSettleAmount'
         from kuaishou_promoter t1
-        left join(select *
-        from bytedance_promoter_order_list
-        where pay_success_time &gt;= #{bindStartDate}) t2
-        on t1.promoter_id = t2.author_short_id
+        left join
+        (
+        select t1.*
+        from bytedance_promoter_order_list t1
+        LEFT JOIN bytedance_order_list t2 ON t1.order_id = t2.order_id
+        where t2.pay_success_time &gt;= #{bindStartDate}
+        and t2.pay_success_time_hour &lt;= #{hour}
+        ) t2 ON t1.promoter_id = t2.author_short_id
         where 1 = 1
         <if test="bindStartDate != null and bindStartDate != '' ">
             and t1.create_time &gt;= str_to_date(concat(date_format(#{bindStartDate}, '%Y-%m-%d'), '00:00:01'),
@@ -939,7 +1120,34 @@
         <if test="collectSampleId != null and collectSampleId != '' ">
             and t1.user_id = #{collectSampleId}
         </if>
-        group by t1.user_id) t
+        group by t1.user_id
+        ) t
+        left join (
+        select t1.user_id,
+        count(t2.order_id) as 'orderNum'
+        from kuaishou_promoter t1
+        left join
+        (select t1.order_id,t1.author_short_id
+        from bytedance_promoter_order_list t1
+        LEFT JOIN bytedance_order_list t2 ON t1.order_id = t2.order_id
+        where t2.pay_success_time &gt;= #{lastTimeStart}
+        AND t2.pay_success_time &lt;= #{lastTimeEnd}
+        and t2.pay_success_time_hour &lt;= #{hour}
+        ) t2 ON t1.promoter_id = t2.author_short_id
+        where 1 = 1
+        <if test="bindStartDate != null and bindStartDate != '' ">
+            and t1.create_time &gt;= str_to_date(concat(date_format(#{lastTimeStart}, '%Y-%m-%d'), '00:00:01'),
+            '%Y-%m-%d %H:%i:%s')
+        </if>
+        <if test="bindEndDate != null and bindEndDate != '' ">
+            and t1.create_time &lt;= str_to_date(concat(date_format(#{lastTimeEnd}, '%Y-%m-%d'), '23:59:59'), '%Y-%m-%d
+            %H:%i:%s')
+        </if>
+        <if test="collectSampleId != null and collectSampleId != '' ">
+            and t1.user_id = #{collectSampleId}
+        </if>
+        group by t1.user_id
+        )t11 ON t.collectSampleId = t11.user_id
         left join (select user_id,
         count(distinct promoter_id) as 'promoterCount'
         from kuaishou_promoter