|
@@ -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 >= #{start}
|
|
|
AND t1.first_order_time <= #{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 >= #{start}
|
|
|
AND t1.first_order_time <= #{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 >= #{start}
|
|
|
- and stat_date <= #{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 >=#{start}
|
|
|
+ and first_order_time <= #{end}) t2
|
|
|
+ on t1.item_id = t2.item_id
|
|
|
+ where t1.stat_date >= #{start}
|
|
|
+ and t1.stat_date <= #{end}
|
|
|
<if test='nowHour != null and nowHour != ""'>
|
|
|
- and stat_hour <= #{nowHour}
|
|
|
+ and t1.stat_hour <= #{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 >= #{start}
|
|
|
and photo_create_time <= #{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 >=#{start}
|
|
|
+ and first_order_time <= #{end}) t3
|
|
|
+ on t2.item_id = t3.item_id
|
|
|
where 1 = 1
|
|
|
and t1.expert_mentor_id is not null
|
|
|
and t2.stat_date >= #{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 >=#{start}
|
|
|
+ and first_order_time <= #{end}) t3
|
|
|
+ on t2.item_id = t3.item_id
|
|
|
where 1 = 1
|
|
|
and t1.expert_business_id is not null
|
|
|
and t2.stat_date >= #{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 >= #{lastStart}
|
|
|
and t2.stat_date <= #{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 >= #{start}
|
|
|
+ AND stat_date <= #{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 >= #{start}
|
|
|
+ AND t1.first_order_time <= #{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 >= #{start}
|
|
|
+ AND stat_date <= #{end}
|
|
|
+ AND clip_user_id = #{clipUserId}
|
|
|
+ GROUP BY item_id) t2
|
|
|
+ ON t1.item_id = t2.item_id
|
|
|
+ WHERE t1.first_order_time >= #{start}
|
|
|
+ AND t1.first_order_time <= #{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 >= #{start}
|
|
|
+ AND photo_create_time <= #{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 >= #{start}
|
|
|
+ and first_order_time <= #{end} ) t3
|
|
|
+ on t1.item_id = t3.item_id
|
|
|
+ where t1.stat_date >= #{start}
|
|
|
+ and t1.stat_date <= #{end}
|
|
|
+ <if test='nowHour != null and nowHour != ""'>
|
|
|
+ and t1.stat_hour <= #{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 >= #{lastStart}
|
|
|
+ and t1.stat_date <= #{lastEnd}
|
|
|
+ <if test='nowHour != null and nowHour != ""'>
|
|
|
+ and t1.stat_hour <= #{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>
|