|
@@ -36,7 +36,9 @@
|
|
|
|
|
|
</insert>
|
|
|
<delete id="deleteAuthItem">
|
|
|
- delete from jy_auth_order where 1 = 1
|
|
|
+ delete
|
|
|
+ from jy_auth_order
|
|
|
+ where 1 = 1
|
|
|
</delete>
|
|
|
|
|
|
<select id="item" resultType="com.alibaba.fastjson.JSONObject">
|
|
@@ -653,75 +655,123 @@
|
|
|
</select>
|
|
|
<select id="dayData" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
select *,
|
|
|
- t1.gmv - t2.lastGmv as 'gvmGap',
|
|
|
- t1.orderNum - t2.lastOrderNum as 'orderNumGap',
|
|
|
- t1.validGmv - t2.lastValidGmv as 'validGmvGap',
|
|
|
- t1.validOrderNUm - t2.lastValidOrderNUm as 'validOrderNumGap',
|
|
|
- t1.mcnPromotionAmount - t2.lastMcnPromotionAmount as 'mcnPromotionAmountGap',
|
|
|
- t1.grossMargin - t2.lastGrossMargin as 'grossMarginGap'
|
|
|
-from (select date_format(#{date},'%Y/%m/%d') as 'date',
|
|
|
- round(sum(pay_amount) / 100, 2) as 'gmv',
|
|
|
- count(oid) as 'orderNum',
|
|
|
- round(sum(case when order_status != 80 then pay_amount else 0 end) / 100, 2) as 'validGmv',
|
|
|
- sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNum',
|
|
|
- round(sum(mcn_promotion_amount) / 100, 2) as 'mcnPromotionAmount',
|
|
|
- round(sum(mcn_promotion_amount) / sum(pay_amount) * 100, 2) as 'grossMargin'
|
|
|
- from jy_order_list t1 left join jy_kuaishou_promoter t2
|
|
|
- on t1.clip_user_id = t2.promoter_id
|
|
|
- where t1.stat_date = #{date}
|
|
|
- and t2.type = 1
|
|
|
- ) t1
|
|
|
- join (select date_format(#{lastDate} ,'%Y/%m/%d') as 'lastDate',
|
|
|
- round(sum(pay_amount) / 100, 2) as 'lastGmv',
|
|
|
- count(oid) as 'lastOrderNum',
|
|
|
- round(sum(case when order_status != 80 then pay_amount else 0 end) / 100, 2) as 'lastValidGmv',
|
|
|
- sum(case when order_status != 80 then 1 else 0 end) as 'lastValidOrderNum',
|
|
|
- round(sum(mcn_promotion_amount) / 100, 2) as 'lastMcnPromotionAmount',
|
|
|
- round(sum(mcn_promotion_amount) / sum(pay_amount) * 100, 2) as 'lastGrossMargin'
|
|
|
- from jy_order_list t1 left join jy_kuaishou_promoter t2
|
|
|
- on t1.clip_user_id = t2.promoter_id
|
|
|
- where t1.stat_date = #{lastDate}
|
|
|
- and t2.type = 1
|
|
|
- ) t2
|
|
|
+ t1.gmv - t2.lastGmv as 'gvmGap',
|
|
|
+ t1.orderNum - t2.lastOrderNum as 'orderNumGap',
|
|
|
+ t1.validGmv - t2.lastValidGmv as 'validGmvGap',
|
|
|
+ t1.validOrderNUm - t2.lastValidOrderNUm as 'validOrderNumGap',
|
|
|
+ t1.mcnPromotionAmount - t2.lastMcnPromotionAmount as 'mcnPromotionAmountGap',
|
|
|
+ t1.grossMargin - t2.lastGrossMargin as 'grossMarginGap'
|
|
|
+ from (select date_format(#{date},'%Y/%m/%d') as 'date',
|
|
|
+ round(sum(pay_amount) / 100, 2) as 'gmv',
|
|
|
+ count(oid) as 'orderNum',
|
|
|
+ round(sum(case when order_status != 80 then pay_amount else 0 end) / 100, 2) as 'validGmv',
|
|
|
+ sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNum',
|
|
|
+ round(sum(mcn_promotion_amount) / 100, 2) as 'mcnPromotionAmount',
|
|
|
+ round(sum(mcn_promotion_amount) / sum(pay_amount) * 100, 2) as 'grossMargin'
|
|
|
+ from ruixuan.jy_order_list t1
|
|
|
+ where t1.stat_date = #{date}
|
|
|
+ <if test='dataType == "1" '>
|
|
|
+ and t1.clip_user_id in (
|
|
|
+ select promoter_id from ruixuan.jy_kuaishou_promoter
|
|
|
+ where `type` = 1
|
|
|
+ group by promoter_id
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test=' dataType == "2" '>
|
|
|
+ and t1.clip_user_id not in (
|
|
|
+ select promoter_id from ruixuan.jy_kuaishou_promoter
|
|
|
+ where `type` = 1
|
|
|
+ group by promoter_id
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ ) t1
|
|
|
+ join (select date_format(#{lastDate} ,'%Y/%m/%d') as 'lastDate',
|
|
|
+ round(sum(pay_amount) / 100, 2) as 'lastGmv',
|
|
|
+ count(oid) as 'lastOrderNum',
|
|
|
+ round(sum(case when order_status != 80 then pay_amount else 0 end) / 100, 2) as 'lastValidGmv',
|
|
|
+ sum(case when order_status != 80 then 1 else 0 end) as 'lastValidOrderNum',
|
|
|
+ round(sum(mcn_promotion_amount) / 100, 2) as 'lastMcnPromotionAmount',
|
|
|
+ round(sum(mcn_promotion_amount) / sum(pay_amount) * 100, 2) as 'lastGrossMargin'
|
|
|
+ from ruixuan.jy_order_list t1
|
|
|
+ where t1.stat_date = #{lastDate}
|
|
|
+ <if test='dataType == "1"'>
|
|
|
+ and t1.clip_user_id in (
|
|
|
+ select promoter_id from ruixuan.jy_kuaishou_promoter
|
|
|
+ where `type` = 1
|
|
|
+ group by promoter_id
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test='dataType == "2" '>
|
|
|
+ and t1.clip_user_id not in (
|
|
|
+ select promoter_id from ruixuan.jy_kuaishou_promoter
|
|
|
+ where `type` = 1
|
|
|
+ group by promoter_id
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ ) t2
|
|
|
|
|
|
</select>
|
|
|
<select id="monthData" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
|
select *,
|
|
|
- concat(ROUND((t1.gmv - t2.lastGmv) / t2.lastGmv * 100, 2) ,'%') as 'gvmRadio',
|
|
|
+ concat(ROUND((t1.gmv - t2.lastGmv) / t2.lastGmv * 100, 2) ,'%') as 'gvmRadio',
|
|
|
concat(ROUND((t1.orderNum - t2.lastOrderNum) / t2.lastOrderNum * 100, 2),'%') as 'orderNumRadio',
|
|
|
concat(ROUND((t1.validGmv - t2.lastValidGmv) / t2.lastValidGmv * 100, 2) ,'%')as 'validGmvRadio',
|
|
|
concat(ROUND((t1.validOrderNUm - t2.lastValidOrderNUm) / t2.lastValidOrderNUm * 100,
|
|
|
- 2) ,'%')as 'validOrderNumRadio',
|
|
|
+ 2) ,'%')as 'validOrderNumRadio',
|
|
|
concat(ROUND((t1.mcnPromotionAmount - t2.lastMcnPromotionAmount) / t2.lastMcnPromotionAmount * 100,
|
|
|
- 2) ,'%')as 'mcnPromotionAmountRadio',
|
|
|
+ 2) ,'%')as 'mcnPromotionAmountRadio',
|
|
|
ROUND((t1.grossMargin - t2.lastGrossMargin) / t2.lastGrossMargin * 100,
|
|
|
- 2) as 'grossMarginRadio'
|
|
|
- from (select CONCAT(date_format(#{nowMonthEndDate} ,'%Y/%m/%d') , '合计') as 'date',
|
|
|
- round(sum(pay_amount) / 100, 2) as 'gmv',
|
|
|
- count(oid) as 'orderNum',
|
|
|
+ 2) as 'grossMarginRadio'
|
|
|
+ from (select CONCAT(date_format(#{nowMonthEndDate} ,'%Y/%m/%d') , '合计') as 'date',
|
|
|
+ round(sum(pay_amount) / 100, 2) as 'gmv',
|
|
|
+ count(oid) as 'orderNum',
|
|
|
round(sum(case when order_status != 80 then pay_amount else 0 end) / 100, 2) as 'validGmv',
|
|
|
- sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNum',
|
|
|
- round(sum(mcn_promotion_amount) / 100, 2) as 'mcnPromotionAmount',
|
|
|
- round(sum(mcn_promotion_amount) / sum(pay_amount) * 100, 2) as 'grossMargin'
|
|
|
- from jy_order_list t1 left join jy_kuaishou_promoter t2
|
|
|
- on t1.clip_user_id = t2.promoter_id
|
|
|
+ sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNum',
|
|
|
+ round(sum(mcn_promotion_amount) / 100, 2) as 'mcnPromotionAmount',
|
|
|
+ round(sum(mcn_promotion_amount) / sum(pay_amount) * 100, 2) as 'grossMargin'
|
|
|
+ from jy_order_list t1
|
|
|
where t1.stat_date >= #{nowMonthStartDate}
|
|
|
and t1.stat_date <= #{nowMonthEndDate}
|
|
|
- and t2.type = 1
|
|
|
+ <if test='dataType == "1"'>
|
|
|
+ and t1.clip_user_id in (
|
|
|
+ select promoter_id from jy_kuaishou_promoter
|
|
|
+ where `type` = 1
|
|
|
+ group by promoter_id
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test='dataType == "2" '>
|
|
|
+ and t1.clip_user_id not in (
|
|
|
+ select promoter_id from jy_kuaishou_promoter
|
|
|
+ where `type` = 1
|
|
|
+ group by promoter_id
|
|
|
+ )
|
|
|
+ </if>
|
|
|
) t1
|
|
|
- join (select CONCAT(date_format(#{lastMonthEndDate} ,'%Y/%m/%d') , '合计') as 'lastDate',
|
|
|
- round(sum(pay_amount) / 100, 2) as 'lastGmv',
|
|
|
- count(oid) as 'lastOrderNum',
|
|
|
+ join (select CONCAT(date_format(#{lastMonthEndDate} ,'%Y/%m/%d') , '合计') as 'lastDate',
|
|
|
+ round(sum(pay_amount) / 100, 2) as 'lastGmv',
|
|
|
+ count(oid) as 'lastOrderNum',
|
|
|
round(sum(case when order_status != 80 then pay_amount else 0 end) / 100, 2) as 'lastValidGmv',
|
|
|
- sum(case when order_status != 80 then 1 else 0 end) as 'lastValidOrderNum',
|
|
|
- round(sum(mcn_promotion_amount) / 100, 2) as 'lastMcnPromotionAmount',
|
|
|
- round(sum(mcn_promotion_amount) / sum(pay_amount) * 100, 2) as 'lastGrossMargin'
|
|
|
- from jy_order_list t1 left join jy_kuaishou_promoter t2
|
|
|
- on t1.clip_user_id = t2.promoter_id
|
|
|
+ sum(case when order_status != 80 then 1 else 0 end) as 'lastValidOrderNum',
|
|
|
+ round(sum(mcn_promotion_amount) / 100, 2) as 'lastMcnPromotionAmount',
|
|
|
+ round(sum(mcn_promotion_amount) / sum(pay_amount) * 100, 2) as 'lastGrossMargin'
|
|
|
+ from jy_order_list t1
|
|
|
where t1.stat_date >= #{lastMonthStartDate}
|
|
|
- and t1.stat_date <= #{lastMonthEndDate}
|
|
|
- and t2.type = 1
|
|
|
+ and t1.stat_date <= #{lastMonthEndDate}
|
|
|
+ <if test='dataType == "1"'>
|
|
|
+ and t1.clip_user_id in (
|
|
|
+ select promoter_id from jy_kuaishou_promoter
|
|
|
+ where `type` = 1
|
|
|
+ group by promoter_id
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test='dataType == "2"'>
|
|
|
+ and t1.clip_user_id not in (
|
|
|
+ select promoter_id from jy_kuaishou_promoter
|
|
|
+ where `type` = 1
|
|
|
+ group by promoter_id
|
|
|
+ )
|
|
|
+ </if>
|
|
|
) t2
|
|
|
</select>
|
|
|
<select id="getTopItem" resultType="com.alibaba.fastjson.JSONObject">
|
|
@@ -762,18 +812,20 @@ from (select date_format(#{date},'%Y/%m/%d')
|
|
|
order by ${fieId} ${sort}
|
|
|
</select>
|
|
|
<select id="getTopItemUser" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
- select id,name from jy_fx_top_item_config
|
|
|
+ select id, name
|
|
|
+ from jy_fx_top_item_config
|
|
|
</select>
|
|
|
<select id="getDataByDate" resultType="com.alibaba.fastjson.JSONObject" parameterType="java.lang.Long">
|
|
|
select stat_hour as 'time', round(sum(order_amount) / 100, 2) as 'charge'
|
|
|
-from jy_order_list
|
|
|
-where stat_date = #{date}
|
|
|
-group by stat_hour
|
|
|
-order by stat_hour
|
|
|
+ from jy_order_list
|
|
|
+ where stat_date = #{date}
|
|
|
+ group by stat_hour
|
|
|
+ order by stat_hour
|
|
|
|
|
|
</select>
|
|
|
<select id="getJiaoYangCookie" resultType="java.lang.String">
|
|
|
- select cookie from jy_fx_cookie limit 1
|
|
|
+ select cookie
|
|
|
+ from jy_fx_cookie limit 1
|
|
|
</select>
|
|
|
<select id="getAuthItemList" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
select
|