yumeng 1 年間 前
コミット
ade7ba26cf

+ 21 - 8
ruixuan-live/src/main/resources/mapper/isc/SupplyChainMapper.xml

@@ -2670,14 +2670,26 @@
         from (
         select t1.user_id as 'collectSampleId',
         t1.user_name as 'collectSampleName',
-        count(t2.oid) as 'orderNum',
-        sum(case when t2.order_status != 80 then 1 else 0 end) as 'validOrderNum',
-        concat(round(sum(case when t2.order_status != 80 then 1 else 0 end) /  count(t2.oid) * 100, 2), '%') as 'validOrderRate',
-        round(sum(t2.order_amount) / 100, 2) as 'orderAmount',
-        round(sum(t2.regimental_promotion_amount) / 100, 2) as 'regimentalPromotionAmount',
-        round(sum(t2.total_regimental_settle_amount) / 100, 2) as 'totalRegimentalSettleAmount'
+        sum(t2.orderNum) as 'orderNum',
+        sum(t2.validOrderNum) as 'validOrderNum',
+        concat(round( sum(t2.validOrderNum) / sum(t2.orderNum) * 100,
+        2),
+        '%') as 'validOrderRate',
+        round(sum(t2.orderAmount) / 100, 2) as 'orderAmount',
+        round(sum(t2.regimentalPromotionAmount) / 100, 2) as 'regimentalPromotionAmount',
+        round(sum(t2.totalRegimentalSettleAmount) / 100, 2) as 'totalRegimentalSettleAmount'
         from promoter_bind_channel_date t1
-        left join kuaishou_supply_chain t2
+        left join (select promoter_id as 'promoter_id',
+        stat_date as 'stat_date',
+        count(oid) as 'orderNum',
+        sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNum',
+        sum(order_amount) as 'orderAmount',
+        sum(regimental_promotion_amount) as 'regimentalPromotionAmount',
+        sum(total_regimental_settle_amount) as 'totalRegimentalSettleAmount'
+        from kuaishou_supply_chain
+        where stat_date >= #{start}
+        and stat_date <= #{end}
+        group by promoter_id, stat_date) t2
         on t1.promoter_id = t2.promoter_id and t1.stat_date = t2.stat_date
         where 1 = 1
         and t1.media_id = 2
@@ -2710,7 +2722,8 @@
             and collect_sample_id = #{collectSampleId}
         </if>
         <if test="start != null and start != ''">
-            and create_time &gt;= str_to_date(concat(date_format(#{start}, '%Y-%m-%d'), '00:00:01'), '%Y-%m-%d %H:%i:%s')
+            and create_time &gt;= str_to_date(concat(date_format(#{start}, '%Y-%m-%d'), '00:00:01'), '%Y-%m-%d
+            %H:%i:%s')
         </if>
         <if test="end != null and end != ''">
             and create_time &lt;= str_to_date(concat(date_format(#{end}, '%Y-%m-%d'), '23:59:59'), '%Y-%m-%d %H:%i:%s')