yumeng 1 年間 前
コミット
a081a2dd28

+ 15 - 1
ruixuan-live/src/main/java/com/ruixuan/isc/controller/KuaishouPromoterController.java

@@ -100,7 +100,7 @@ public class KuaishouPromoterController extends BaseController {
         if (Check.isNotNull(promoterId)) {
             promoterId = promoterId.trim();
         }
-        List<KuaishouPromoter> list = kuaishouPromoterService.selectKuaishouPromoterList(userId, promoterId, promoterNickName, mediaId, parameter, orderBy, bdUserId,searchPhone);
+        List<KuaishouPromoter> list = kuaishouPromoterService.selectKuaishouPromoterList(userId, promoterId, promoterNickName, mediaId, parameter, orderBy, bdUserId, searchPhone);
         return getDataTable(list);
     }
 
@@ -247,6 +247,20 @@ public class KuaishouPromoterController extends BaseController {
         }
     }
 
+
+    @PostMapping(value = "/jy_auth")
+    @ApiOperation(value = "新增骄阳达人")
+    public JSONObject jy_auth() throws InterruptedException {
+        List<Long> list = kuaishouPromoterService.getAllJyPromoterList();
+        for (int i = 0; i < list.size(); i++) {
+            Long l = list.get(i);
+            kuaishouPromoterService.addAuth(l);
+            Thread.sleep(10 * 1000L);
+        }
+        return null;
+    }
+
+
     /**
      * 新增 设置渠道绑定达人数
      */

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

@@ -149,4 +149,7 @@ public interface KuaishouPromoterMapper {
 
     void updateYufuKuaishouPromoterByPromoterId(KuaishouPromoter kuaishouPromoter);
 
+    String getAuthCookie();
+
+    List<Long> getAllJyPromoterList();
 }

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

@@ -88,6 +88,7 @@ public interface IKuaishouPromoterService {
     List<String> selectPromoterIdListByTime(List<Long> userList, Long startDate, Long endDate);
 
     JSONObject insertKuaishouPromoter3(JYKuaishouPromoter kuaishouPromoter);
+    JSONObject addAuth(Long  promoterId);
 
     int updateKuaishouPromoter3(JYKuaishouPromoter kuaishouPromoter);
 
@@ -100,4 +101,6 @@ public interface IKuaishouPromoterService {
     List<JSONObject> jyExpertBusiness();
 
     void importExcelMaterials(MultipartFile file) throws InterruptedException;
+
+    List<Long> getAllJyPromoterList();
 }

+ 27 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouPromoterServiceImpl.java

@@ -635,6 +635,11 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
             }
         }
         kuaishouPromoterMapper.insertKuaishouPromoter3(promoter);
+        if (promoter.getMediaId().equals("2")) {
+            addAuth(Long.valueOf(promoter.getPromoterId()));
+        }
+
+
         editPromoter3(promoter.getId(), promoter.getMediaId(), promoter.getPromoterId(), true);
         result.put("code", 200);
         result.put("msg", "success");
@@ -642,6 +647,23 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
     }
 
     @Override
+    public JSONObject addAuth(Long promoterId) {
+
+        String cookie = kuaishouPromoterMapper.getAuthCookie();
+        Map<String, Object> param = new HashMap<>();
+        param.put("userId", promoterId);
+        param.put("appKey", "ks690458118961229051");
+        param.put("type", 2);
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Cookie", cookie);
+        String url = "https://open.kwaixiaodian.com/rest/open/platform/oauth/add";
+        String s = HttpUtil.httpPostRequest(url, param, headers);
+        JSONObject jsonObject = JSONObject.parseObject(s);
+        log.info("爬虫增加授权账户返回信息:{}", jsonObject);
+        return jsonObject;
+    }
+
+    @Override
     public Result supplementInfo() {
         List<KuaishouPromoter> list = kuaishouPromoterMapper.getFailInfo();
         Thread thread = new Thread() {
@@ -972,6 +994,11 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
         log.info("------共用时" + (System.currentTimeMillis() - t1) / 1000 + "秒");
     }
 
+    @Override
+    public List<Long> getAllJyPromoterList() {
+        return kuaishouPromoterMapper.getAllJyPromoterList();
+    }
+
     public List<FirstDeliveryValidMaterials> analysisBIGBIGFile(MultipartFile mfile, String path) throws Exception {
         InputStream is = null;
         String newFileUrl = FileUtil.approvalFile(mfile, path);

+ 136 - 2
ruixuan-live/src/main/java/com/ruixuan/jiaoyang/controller/JiaoYangDingPanController.java

@@ -452,6 +452,7 @@ public class JiaoYangDingPanController extends BaseController {
         return returnJson;
     }
 
+
     // 分达人数据
     @GetMapping("/getPromoterList")
     @ApiOperation(value = "切片盯盘-成员数据")
@@ -701,6 +702,87 @@ public class JiaoYangDingPanController extends BaseController {
         return returnJson;
     }
 
+
+    @GetMapping("/getAddItemListByExpertId")
+    @ApiOperation(value = "切片盯盘-新增商品")
+    public JSONObject getAddItemListByExpertId(Long userId, String userType, String startDate, String endDate) {
+        Map<String, Object> requestMap = new HashMap<>();
+        JSONObject returnJson = new JSONObject();
+        try {
+            if (Check.isNull(userType)) {
+                throw new Exception("请传入类型");
+            }
+            if (Check.isNull(userId)) {
+                throw new Exception("请传入用户id");
+            }
+            if (Check.isNull(startDate)) {
+                throw new Exception("请传入开始日期");
+            }
+            if (Check.isNull(endDate)) {
+                throw new Exception("请传入结束日期");
+            }
+            if ("导师".equals(userType)) {
+                requestMap.put("expertMentorId", userId);
+            }
+            if ("商务".equals(userType)) {
+                requestMap.put("expertBusinessId", userId);
+            }
+            Long start = DateUtils.strDateToInt(startDate);
+            Long end = DateUtils.strDateToInt(endDate);
+            requestMap.put("start", start);
+            requestMap.put("end", end);
+            List<JSONObject> data = jiaoYangDingPanService.getAddItemListByExpertId(requestMap);
+            returnJson.put("data", data);
+            returnJson.put("code", 200);
+            returnJson.put("success", true);
+        } catch (Exception e) {
+            e.printStackTrace();
+            returnJson.put("code", 500);
+            returnJson.put("success", false);
+            returnJson.put("message", e.getMessage());
+        }
+        return returnJson;
+    }
+
+    @GetMapping("/getAddItemListByClipUserId")
+    @ApiOperation(value = "切片盯盘-新增商品")
+    public JSONObject getAddItemListByClipUserId(Long clipUserId, String startDate, String endDate) {
+        Map<String, Object> requestMap = new HashMap<>();
+        JSONObject returnJson = new JSONObject();
+        try {
+
+            if (Check.isNull(clipUserId)) {
+                throw new Exception("请传入用户id");
+            }
+            if (Check.isNull(startDate)) {
+                throw new Exception("请传入开始日期");
+            }
+            if (Check.isNull(endDate)) {
+                throw new Exception("请传入结束日期");
+            }
+            if (Check.isNull(endDate)) {
+                throw new Exception("请传入结束日期");
+            }
+
+            Long start = DateUtils.strDateToInt(startDate);
+            Long end = DateUtils.strDateToInt(endDate);
+            requestMap.put("start", start);
+            requestMap.put("end", end);
+            requestMap.put("clipUserId", clipUserId);
+            List<JSONObject> data = jiaoYangDingPanService.getAddItemListByClipUserId(requestMap);
+            returnJson.put("data", data);
+            returnJson.put("code", 200);
+            returnJson.put("success", true);
+        } catch (Exception e) {
+            e.printStackTrace();
+            returnJson.put("code", 500);
+            returnJson.put("success", false);
+            returnJson.put("message", e.getMessage());
+        }
+        return returnJson;
+    }
+
+
     @GetMapping("/getTeamDetail")
     @ApiOperation(value = "切片盯盘")
     public JSONObject getTeamDetail(Long deptId, String startDate, String endDate) {
@@ -717,7 +799,14 @@ public class JiaoYangDingPanController extends BaseController {
                 throw new Exception("请传入结束日期");
             }
 
-            requestMap.put("deptId", deptId);
+            List<Long> promoterIds = jiaoYangDingPanService.getDeptUsers(deptId);
+            if (Check.isNull(promoterIds)) {
+                returnJson.put("code", 200);
+                returnJson.put("data", null);
+                returnJson.put("success", true);
+                return returnJson;
+            }
+            requestMap.put("promoterIds", promoterIds);
             Long start = DateUtils.strDateToInt(startDate);
             Long end = DateUtils.strDateToInt(endDate);
             requestMap.put("start", start);
@@ -733,7 +822,52 @@ public class JiaoYangDingPanController extends BaseController {
                 Integer nowHour = DateUtils.getNowHour();
                 requestMap.put("nowHour", nowHour);
             }
-            List<JSONObject> data = jiaoYangDingPanService.getDingPanMentorBusinessList(requestMap);
+            List<JSONObject> data = jiaoYangDingPanService.getTeamDetail(requestMap);
+            returnJson.put("code", 200);
+            returnJson.put("data", data);
+            returnJson.put("success", true);
+        } catch (Exception e) {
+            e.printStackTrace();
+            returnJson.put("code", 500);
+            returnJson.put("message", e.getMessage());
+        }
+        return returnJson;
+    }
+
+
+    @GetMapping("/getVideoList")
+    @ApiOperation(value = "切片盯盘")
+    public JSONObject getVideoList(Long promoterId, String startDate, String endDate) {
+        Map<String, Object> requestMap = new HashMap<>();
+        JSONObject returnJson = new JSONObject();
+        try {
+            if (Check.isNull(promoterId)) {
+                throw new Exception("请传入达人id");
+            }
+            if (Check.isNull(startDate)) {
+                throw new Exception("请传入开始日期");
+            }
+            if (Check.isNull(endDate)) {
+                throw new Exception("请传入结束日期");
+            }
+
+            requestMap.put("promoterId", promoterId);
+            Long start = DateUtils.strDateToInt(startDate);
+            Long end = DateUtils.strDateToInt(endDate);
+            requestMap.put("start", start);
+            requestMap.put("end", end);
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+            int differDay = DateUtils.differentDaysByMillisecond(simpleDateFormat.parse(startDate), simpleDateFormat.parse(endDate));
+            String lastEndStr = DateUtils.getAnotherDay("yyyy-MM-dd", startDate, -1); // 上一时段结束日期
+            String lastStartStr = DateUtils.getAnotherDay("yyyy-MM-dd", lastEndStr, -differDay); // 上一时段开始日期
+            requestMap.put("lastEnd", DateUtils.strDateToInt(lastEndStr));
+            requestMap.put("lastStart", DateUtils.strDateToInt(lastStartStr));
+            Long nowDate = Long.valueOf(DateUtils.getNowDate("yyyyMMdd"));
+            if (start.equals(nowDate) && end.equals(nowDate)) {
+                Integer nowHour = DateUtils.getNowHour();
+                requestMap.put("nowHour", nowHour);
+            }
+            List<JSONObject> data = jiaoYangDingPanService.getVideoList(requestMap);
             returnJson.put("code", 200);
             returnJson.put("data", data);
             returnJson.put("success", true);

+ 10 - 0
ruixuan-live/src/main/java/com/ruixuan/jiaoyang/mapper/IJiaoYangDingMapper.java

@@ -36,4 +36,14 @@ public interface IJiaoYangDingMapper {
     List<JSONObject> getDingPanTuiGuangUserList(Map<String, Object> requestMap);
 
     List<JSONObject> getDingPanMentorBusinessList(Map<String, Object> requestMap);
+
+    List<JSONObject> getAddItemListByExpertId(Map<String, Object> requestMap);
+
+    List<JSONObject> getAddItemListByClipUserId(Map<String, Object> requestMap);
+
+    List<JSONObject> getVideoList(Map<String, Object> requestMap);
+
+    List<JSONObject> getTeamDetail(Map<String, Object> requestMap);
+
+    List<Long> getDeptUsers(@Param("deptId") Long deptId);
 }

+ 10 - 0
ruixuan-live/src/main/java/com/ruixuan/jiaoyang/service/IJiaoYangDingPanService.java

@@ -35,4 +35,14 @@ public interface IJiaoYangDingPanService {
     List<JSONObject> getDingPanTuiGuangUserList(Map<String, Object> requestMap);
 
     List<JSONObject> getDingPanMentorBusinessList(Map<String, Object> requestMap);
+
+    List<JSONObject> getAddItemListByExpertId(Map<String, Object> requestMap);
+
+    List<JSONObject> getAddItemListByClipUserId(Map<String, Object> requestMap);
+
+    List<JSONObject> getVideoList(Map<String, Object> requestMap);
+
+    List<JSONObject> getTeamDetail(Map<String, Object> requestMap);
+
+    List<Long> getDeptUsers(Long deptId);
 }

+ 25 - 0
ruixuan-live/src/main/java/com/ruixuan/jiaoyang/service/impl/JiaoYangDingPanServiceImpl.java

@@ -88,4 +88,29 @@ public class JiaoYangDingPanServiceImpl implements IJiaoYangDingPanService {
     public List<JSONObject> getDingPanMentorBusinessList(Map<String, Object> requestMap) {
         return jiaoYangDingMapper.getDingPanMentorBusinessList(requestMap);
     }
+
+    @Override
+    public List<JSONObject> getAddItemListByExpertId(Map<String, Object> requestMap) {
+        return jiaoYangDingMapper.getAddItemListByExpertId(requestMap);
+    }
+
+    @Override
+    public List<JSONObject> getAddItemListByClipUserId(Map<String, Object> requestMap) {
+        return jiaoYangDingMapper.getAddItemListByClipUserId(requestMap);
+    }
+
+    @Override
+    public List<JSONObject> getVideoList(Map<String, Object> requestMap) {
+        return jiaoYangDingMapper.getVideoList(requestMap);
+    }
+
+    @Override
+    public List<JSONObject> getTeamDetail(Map<String, Object> requestMap) {
+        return jiaoYangDingMapper.getTeamDetail(requestMap);
+    }
+
+    @Override
+    public List<Long> getDeptUsers(Long deptId) {
+        return jiaoYangDingMapper.getDeptUsers(deptId);
+    }
 }

+ 10 - 0
ruixuan-live/src/main/resources/mapper/isc/KuaishouPromoterMapper.xml

@@ -1055,6 +1055,16 @@
         where t2.role_key = 'jy_expert_business'
         order by t3.create_time desc
     </select>
+    <select id="getAuthCookie" resultType="java.lang.String">
+        SELECT cookie
+        FROM jy_fx_auth_cookie limit 1
+    </select>
+    <select id="getAllJyPromoterList" resultType="java.lang.Long">
+        SELECT promoter_id
+        FROM jy_kuaishou_promoter
+        ORDER BY create_time DESC
+
+    </select>
 
 
     <insert id="addPromotersCount">

+ 172 - 30
ruixuan-live/src/main/resources/mapper/jiaoyang/JiaoYangDingPanMapper.xml

@@ -208,20 +208,13 @@
         )
         and user.status = 0
         limit 1) as 'leaderName',
-        (select count(user.user_id)
-        from sys_user user
-        left join sys_user_role userRole on user.user_id = userRole.user_id
-        left join sys_role role on userRole.role_id = role.role_id
-        where user.dept_id = t.deptId
-        and role.role_key not in (
-        'jy_expert_business', 'jy_expert_mentor'
-        )
-        and user.status = 0) as 'teamMember',
+
         round((t.orderNum - tt.orderNum) / tt.orderNum * 100, 2) as 'orderNumRate',
         round((t.payAmount - tt.payAmount) / tt.payAmount * 100, 2) as 'payAmountRate'
 
         from (select t4.dept_id as 'deptId',
         t4.dept_name as 'deptName',
+        (count(distinct t2.user_id)) as 'teamMember',
         count(t1.oid) as 'orderNum',
         round(sum(case when t1.order_status != 80 then 1 else 0 end) / count(t1.oid) * 100,
         2) as 'validRadio',
@@ -313,7 +306,7 @@
                              GROUP BY item_id) t2 ON t1.item_id = t2.item_id
         WHERE t1.first_order_time &gt;= #{start}
           AND t1.first_order_time &lt;= #{end}
-
+        ORDER BY t1.first_order_time DESC
     </select>
     <select id="getPeopleList" resultType="com.alibaba.fastjson.JSONObject">
         select t.*,
@@ -420,6 +413,7 @@
                              GROUP BY item_id) t2 ON t1.item_id = t2.item_id
         WHERE t1.first_order_time &gt;= #{start}
           AND t1.first_order_time &lt;= #{end}
+        order by t1.first_order_time desc
     </select>
     <select id="getPromoterList" resultType="com.alibaba.fastjson.JSONObject">
         select t1.*,
@@ -434,39 +428,48 @@
         t3.videoCount as 'videoCount',
         round((t1.orderNum - t4.orderNum) / t4.orderNum * 100, 2) as 'orderNumRate',
         round((t1.payAmount - t4.payAmount) / t4.payAmount * 100, 2) as 'payAmountRate'
-        from (select clip_user_id as 'clipUserId',
-        clip_nick_name as 'clipNickName',
-        count(oid) as 'orderNum',
-        round(sum(case when order_status != 80 then 1 else 0 end) / count(oid) * 100,
+        from (select t1.clip_user_id as 'clipUserId',
+        t1.clip_nick_name as 'clipNickName',
+        count(t1.oid) as 'orderNum',
+        round(sum(case when t1.order_status != 80 then 1 else 0 end) / count(t1.oid) * 100,
         2) as 'validRadio',
 
-        round(sum(pay_amount) / 100, 2) as 'payAmount',
-        round(sum(case when order_status != 80 then pay_amount else 0 end) / 100,
+        round(sum(t1.pay_amount) / 100, 2) as 'payAmount',
+        round(sum(case when t1.order_status != 80 then t1.pay_amount else 0 end) / 100,
         2) as 'validPayAmount',
-        round(sum(case when order_status != 80 then pay_amount else 0 end) / sum(pay_amount) * 100,
+        round(sum(case when t1.order_status != 80 then t1.pay_amount else 0 end) / sum(t1.pay_amount) * 100,
         2) as 'validPayAmountRadio',
-        sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
-        round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case
-        when order_status != 80
+        sum(case when t1.send_status = 0 and t1.order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
+        round(sum(case when t1.send_status = 1 and t1.order_status != 80 then 1 else 0 end) / sum(case
+        when t1.order_status != 80
         then 1
         else 0 end) *
         100,
         2) as 'deliveryRadio',
-        count(distinct item_id) as 'itemCount'
-        from jy_order_list
-        where stat_date &gt;= #{start}
-        and stat_date &lt;= #{end}
+        count(distinct t1.item_id) as 'itemCount',
+        count(distinct t2.item_id) as 'addItemCount'
+
+
+        from jy_order_list  t1
+        left join (
+        select *
+        from jy_order_item_list
+        where first_order_time &gt;=#{start}
+        and first_order_time &lt;= #{end}) t2
+        on t1.item_id = t2.item_id
+        where t1.stat_date &gt;= #{start}
+        and t1.stat_date &lt;= #{end}
         <if test='nowHour != null and nowHour != ""'>
-            and stat_hour &lt;= #{nowHour}
+            and t1.stat_hour &lt;= #{nowHour}
         </if>
         <if test='promoterIds != null and promoterIds.size() > 0'>
-            AND clip_user_id in
+            AND t1.clip_user_id in
             <foreach collection="promoterIds" item="item" separator=","
                      open="(" close=")">
                 #{item}
             </foreach>
         </if>
-        group by clip_user_id) t1
+        group by t1.clip_user_id) t1
         left join jy_kuaishou_promoter t2
         on t1.clipUserId = t2.promoter_id
         left join (select promoter_id as 'promoterId', count(photo_id) as 'videoCount'
@@ -474,6 +477,10 @@
         where photo_create_time &gt;= #{start}
         and photo_create_time &lt;= #{end}
         group by promoter_id) t3 on t1.clipUserId = t3.promoterId
+
+
+
+
         left join (select clip_user_id as 'clipUserId',
         count(oid) as 'orderNum',
         round(sum(pay_amount) / 100, 2) as 'payAmount'
@@ -620,10 +627,16 @@
         100,
         2) as 'deliveryRadio',
         count(distinct t2.clip_user_id) as 'promoterCount',
-        count(distinct t2.item_id) as 'itemCount'
+        count(distinct t2.item_id) as 'itemCount',
+        count(distinct t3.item_id) as 'addItemCount'
         from jy_kuaishou_promoter t1
         left join jy_order_list t2
         on t1.promoter_id = t2.clip_user_id
+        left join (select *
+        from jy_order_item_list
+        where first_order_time &gt;=#{start}
+        and first_order_time &lt;= #{end}) t3
+        on t2.item_id = t3.item_id
         where 1 = 1
         and t1.expert_mentor_id is not null
         and t2.stat_date &gt;= #{start}
@@ -672,10 +685,16 @@
         100,
         2) as 'deliveryRadio',
         count(distinct t2.clip_user_id) as 'promoterCount',
-        count(distinct t2.item_id) as 'itemCount'
+        count(distinct t2.item_id) as 'itemCount',
+        count(distinct t3.item_id) as 'addItemCount'
         from jy_kuaishou_promoter t1
         left join jy_order_list t2
         on t1.promoter_id = t2.clip_user_id
+        left join (select *
+        from jy_order_item_list
+        where first_order_time &gt;=#{start}
+        and first_order_time &lt;= #{end}) t3
+        on t2.item_id = t3.item_id
         where 1 = 1
         and t1.expert_business_id is not null
         and t2.stat_date &gt;= #{start}
@@ -692,7 +711,6 @@
         on t1.promoter_id = t2.clip_user_id
         where 1 = 1
         and t1.expert_business_id is not null
-
         and t2.stat_date &gt;= #{lastStart}
         and t2.stat_date &lt;= #{lastEnd}
         <if test='nowHour != null and nowHour != ""'>
@@ -703,4 +721,128 @@
         order by tlist.`type` asc ,tlist.`orderNum` desc
 
     </select>
+    <select id="getAddItemListByExpertId" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT t1.item_id AS 'itemId', t1.item_title AS 'itemTitle', t1.image_url AS 'image_url', round(t1.reserve_price
+        / 100, 2) AS 'reserve_price', t1.first_order_time AS 'firstOrderTime'
+        FROM jy_order_item_list t1
+        INNER JOIN (SELECT item_id
+        FROM jy_order_list
+        WHERE stat_date &gt;= #{start}
+        AND stat_date &lt;= #{end}
+        AND clip_user_id IN (SELECT promoter_id
+        FROM jy_kuaishou_promoter
+        WHERE 1 = 1
+        <if test='expertMentorId != null and expertMentorId != ""'>
+            and expert_mentor_id = #{expertMentorId}
+        </if>
+        <if test='expertBusinessId != null and expertBusinessId != ""'>
+            and expert_business_id = #{expertBusinessId}
+        </if>
+        GROUP BY promoter_id)
+        GROUP BY item_id) t2 ON t1.item_id = t2.item_id
+        WHERE t1.first_order_time &gt;= #{start}
+        AND t1.first_order_time &lt;= #{end}
+        order by t1.first_order_time desc
+
+    </select>
+    <select id="getAddItemListByClipUserId" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT t1.item_id AS 'itemId', t1.item_title AS 'itemTitle', t1.image_url AS 'image_url', round(t1.reserve_price
+            / 100, 2) AS 'reserve_price', t1.first_order_time AS 'firstOrderTime'
+        FROM jy_order_item_list t1
+                 INNER JOIN (SELECT item_id
+                             FROM jy_order_list
+                             WHERE stat_date &gt;= #{start}
+                               AND stat_date &lt;= #{end}
+                               AND clip_user_id = #{clipUserId}
+                             GROUP BY item_id) t2
+        ON t1.item_id = t2.item_id
+        WHERE t1.first_order_time &gt;= #{start}
+          AND t1.first_order_time &lt;= #{end}
+        ORDER BY t1.first_order_time DESC
+    </select>
+    <select id="getVideoList" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT promoter_id 'promoterId', photo_id 'photoId', caption 'caption', cover 'cover', play_url 'playUrl', photo_create_time 'photoCreateTime', like_count 'likeCount', comment_count 'commentCount', view_count AS 'viewCount'
+        FROM kuaishou_open_photo_list
+        WHERE promoter_id = #{promoterId}
+          AND photo_create_time &gt;= #{start}
+          AND photo_create_time &lt;= #{end}
+        ORDER BY photo_create_time DESC
+    </select>
+    <select id="getTeamDetail" resultType="com.alibaba.fastjson.JSONObject">
+        select t.*,
+        round((t.orderNum - tt.orderNum) / tt.orderNum * 100, 2) as 'orderNumRate',
+        round((t.payAmount - tt.payAmount) / tt.payAmount * 100, 2) as 'payAmountRate'
+        from (select t2.user_id as 'userId',
+        t2.user_name as 'userName',
+        count(t1.oid) as 'orderNum',
+        round(sum(case when t1.order_status != 80 then 1 else 0 end) / count(t1.oid) * 100,
+        2) as 'validRadio',
+
+        round(sum(pay_amount) / 100, 2) as 'payAmount',
+        round(sum(case when order_status != 80 then pay_amount else 0 end) / 100,
+        2) as 'validPayAmount',
+        round(sum(case when t1.order_status != 80 then pay_amount else 0 end) / sum(pay_amount) * 100,
+        2) as 'validPayAmountRadio',
+        sum(case when t1.send_status = 0 and t1.order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
+        round(sum(case when t1.send_status = 1 and t1.order_status != 80 then 1 else 0 end) / sum(case
+        when order_status != 80
+        then 1
+        else 0 end) *
+        100,
+        2) as 'deliveryRadio',
+        count(distinct t1.clip_user_id) as 'promoterCount',
+        count(distinct t1.item_id) as 'itemCount',
+        count(distinct t3.item_id) as 'addItemCount'
+        from jy_order_list t1
+        left join jy_kuaishou_promoter t2
+        on t1.clip_user_id = t2.promoter_id
+        left join (select *
+        from jy_order_item_list
+        where first_order_time &gt;= #{start}
+        and first_order_time &lt;= #{end} ) t3
+        on t1.item_id = t3.item_id
+        where t1.stat_date &gt;= #{start}
+        and t1.stat_date &lt;= #{end}
+        <if test='nowHour != null and nowHour != ""'>
+            and t1.stat_hour &lt;= #{nowHour}
+        </if>
+
+        <if test='promoterIds != null and promoterIds.size() > 0'>
+            AND t1.clip_user_id in
+            <foreach collection="promoterIds" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        and t2.user_id is not null
+        group by t2.user_id) t
+        left join (select t2.user_id as 'userId',
+        count(t1.oid) as 'orderNum',
+        round(sum(pay_amount) / 100, 2) as 'payAmount'
+        from jy_order_list t1
+        left join jy_kuaishou_promoter t2
+        on t1.clip_user_id = t2.promoter_id
+        where t1.stat_date &gt;= #{lastStart}
+        and t1.stat_date &lt;= #{lastEnd}
+        <if test='nowHour != null and nowHour != ""'>
+            and t1.stat_hour &lt;= #{nowHour}
+        </if>
+        <if test='promoterIds != null and promoterIds.size() > 0'>
+            AND t1.clip_user_id in
+            <foreach collection="promoterIds" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        and t2.user_id is not null
+        group by t2.user_id) tt on t.userId = tt.userId
+    </select>
+    <select id="getDeptUsers" resultType="java.lang.Long" parameterType="java.lang.Long">
+        SELECT promoter_id
+        FROM jy_kuaishou_promoter
+        WHERE user_id IN (SELECT user_id
+                          FROM sys_user
+                          WHERE dept_id = #{deptId})
+        GROUP BY promoter_id
+    </select>
 </mapper>