dj_operationreport.sql
24.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
### 章家宝 -----------------start--------------------
UPDATE `report_export_query_sql`
SET `deleted_flag` = 'D'
WHERE `sqlname` = 'querySellerUserUsedipadAnalysis01' AND `deleted_flag` = 'N';
UPDATE `report_export_query_sql`
SET `deleted_flag` = 'D'
WHERE `sqlname` = 'querySellerUserUsedipadAnalysis02' AND `deleted_flag` = 'N';
INSERT INTO `report_export_query_sql` (`sqlname`, `querysql`, `deleted_flag`, `created_date`, `ver_desc`)
VALUES (
'querySellerUserUsedipadAnalysis01',
'select
IFNULL(t0.员工手机号,t0.员工id) as 员工id ,t0.员工姓名,t1.员工手机号,t0.4s店商户号,t0.门店,主服务商id,(case when 主服务商名称=''深圳嘀加'' then ''直营'' else 主服务商名称 end) as 服务商,t0.业务类型,t0.scene_type,
订单数 ,
ifnull(总触客,0) 到店量人,
ifnull(是否派发平板,''否'')是否派发平板,
ifnull(t7.派发日期, ''--'') as 派发日期,
ifnull(接待天数,0)平板出勤,
DATEDIFF(
(case when date_format(''endtimexxxxxx'',''%Y-%m'')=date_format(date_sub(''endtimexxxxxx'',interval 1 week ),''%Y-%m'') then date_sub(''endtimexxxxxx'',interval 1 day ) else date_sub(date_format(''endtimexxxxxx'',''%Y-%m-01''),interval 1 day )end)
,(case when date_format(''endtimexxxxxx'',''%Y-%m'')=date_format(date_sub(''endtimexxxxxx'',interval 1 week ),''%Y-%m'') then date_format(''endtimexxxxxx'',''%Y-%m-01'') else date_sub(date_format(''endtimexxxxxx'',''%Y-%m-01''),interval 1 month )end)
)+2 从1号到上周日的实际天数,
DATEDIFF(
(case when date_format(''endtimexxxxxx'',''%Y-%m'')=date_format(date_sub(''endtimexxxxxx'',interval 1 week ),''%Y-%m'') then date_sub(''endtimexxxxxx'',interval 1 day ) else date_sub(date_format(''endtimexxxxxx'',''%Y-%m-01''),interval 1 day )end)
,(case when date_format(''endtimexxxxxx'',''%Y-%m'')=date_format(date_sub(''endtimexxxxxx'',interval 1 week ),''%Y-%m'') then date_format(''endtimexxxxxx'',''%Y-%m-01'') else date_sub(date_format(''endtimexxxxxx'',''%Y-%m-01''),interval 1 month )end)
)+2 -4 - ifnull(接待天数,0) as 平板缺勤,
ifnull(t5.接待次数,0) 预计接待批次数,
ifnull(t6.接待次数,0) 真实接待数量,
ifnull(总触客,0)- ifnull(t5.接待次数,0) as 录音缺失,
ifnull(t8.report_count, 0) as report_count,
ifnull(t8.approved_count, 0) as approved_count,
now() created_date
from (
SELECT
iam.custodian_phone AS 员工id,
'''' AS 4s店商户号,
'''' AS 业务类型,
'''' AS scene_type,
iam.custodian AS 员工姓名,
'''' AS 门店,
iam.custodian_phone AS 员工手机号
FROM inspection_asset_management iam
WHERE iam.deleted_flag = ''N''
AND NOT EXISTS (
SELECT 1
FROM dj_car_life_staff_info dclsi
WHERE dclsi.deleted_flag = ''N''
AND dclsi.phone_number = iam.custodian_phone
AND EXISTS (
SELECT 1
FROM dj_car_life_goods_order a
LEFT JOIN dj_car_life_pay_order b ON a.order_code = b.order_code
AND b.deleted_flag = ''N''
AND b.order_code IS NOT NULL
WHERE a.seller_user_id = dclsi.staff_uuid
AND a.deleted_flag = ''N''
AND a.status IN (2, 4, 6)
AND a.upgrade_flag IN (''Y'', ''N'')
AND a.seller_user_id IS NOT NULL
AND a.scene_type IN (0, 1)
AND DATE_FORMAT(IFNULL(b.success_date, a.order_time), ''%Y-%m-%d'')
BETWEEN DATE_SUB(DATE_FORMAT(''starttimexxxxxx'', ''%Y-%m-%d''), INTERVAL 1 MONTH) AND ''endtimexxxxxx''
)
)
union
select 员工id,4s店商户号,业务类型, scene_type,员工姓名,4s店商户名称 as 门店,员工手机号
from (
select ifnull(员工手机号,seller_user_id) ''员工id'',ifnull(员工姓名,seller_name) ''员工姓名'',dclgo.scene_type,merchant_id ''4s店商户号'' ,merchant_name ''4s店商户名称'',员工手机号,
(case when dclgo.scene_type=1 then ''精品升级'' when dclgo.scene_type=0 then ''会员权益/升级'' end) 业务类型
from(
select ifnull(b.success_date,a.order_time) order_time ,a.merchant_id, a.merchant_name, a.seller_user_id,a.scene_type,a.seller_name,a.status, a.deleted_flag, a.upgrade_flag
from dj_car_life_goods_order a
left join (select * from dj_car_life_pay_order where deleted_flag = ''N'' and order_code is not null) b on a.order_code=b.order_code
) dclgo
left join (
select staff_uuid 员工uuid,staff_name 员工姓名 ,phone_number 员工手机号 from dj_car_life_staff_info where deleted_flag = ''N''
)dclsi on dclgo.seller_user_id=dclsi.员工uuid
where dclgo.deleted_flag=''N''
and dclgo.status in (2, 4, 6)
and dclgo.upgrade_flag in (''Y'',''N'')
and seller_user_id is not null
and scene_type in (0,1)
and DATE_FORMAT(dclgo.order_time,''%Y-%m-%d'') between date_sub(date_format(''starttimexxxxxx'',''%Y-%m-%d''),INTERVAL 1 month)and ''endtimexxxxxx''
)t group by 员工id,4s店商户号,业务类型
)t0
left join (
select 员工id,4s店商户号,业务类型, scene_type,员工姓名,4s店商户名称 as 门店,
count(distinct (case when upgrade_flag=''Y'' then order_code else null end))订单数
from (
select ifnull(员工手机号,seller_user_id) ''员工id'',seller_name ''员工姓名'', dclgo.scene_type,merchant_id ''4s店商户号'' ,merchant_name ''4s店商户名称'',upgrade_flag,
dclgo.order_code,dclgoc.customer_phone,
(case when dclgo.scene_type=1 then ''精品升级'' when dclgo.scene_type=0 then ''会员权益/升级'' else null end) 业务类型
from(
select ifnull(DATE_FORMAT(b.success_date,''%Y-%m-%d''),DATE_FORMAT(a.order_time,''%Y-%m-%d'')) order_time ,a.merchant_id, a.merchant_name,a.order_code,
a.seller_user_id,a.scene_type,a.business_type,a.seller_name,a.seller_merchant_id,a.seller_merchant_name, a.status, a.deleted_flag, a.upgrade_flag,a.total_price
from dj_car_life_goods_order a
left join (select * from dj_car_life_pay_order where deleted_flag = ''N'' and order_code is not null) b on a.order_code=b.order_code
) dclgo
left join dj_car_life_goods_order_customer dclgoc on dclgo.order_code = dclgoc.order_code and dclgoc.deleted_flag = ''N''
left join (
select staff_uuid 员工uuid,staff_name 员工姓名 ,phone_number 员工手机号 from dj_car_life_staff_info where deleted_flag = ''N''
)dclsi on dclgo.seller_user_id=dclsi.员工uuid
where dclgo.deleted_flag=''N''
and dclgo.status in (2, 4, 6)
and dclgo.upgrade_flag in (''Y'',''N'')
and seller_user_id is not null
and scene_type in (0,1)
and order_time between date_format(''starttimexxxxxx'',''%Y-%m-%d'') and ''endtimexxxxxx''
)t group by 员工id,4s店商户号,业务类型
)t on t0.4s店商户号=t.4s店商户号 and t0.员工id=t.员工id and t0.业务类型=t.业务类型
left join (
select 员工uuid,员工姓名,员工手机号,是否派发平板,scene,主服务商id,主服务商名称,4s店商户号,4s店商户名称 , 园区店商户号 , 园区店商户名称 from (
select ifnull(员工手机号,员工uuid)员工uuid,员工姓名,员工手机号,是否派发平板,scene,主服务商id,主服务商名称,4s店商户号,4s店商户名称 , 园区店商户号 , 园区店商户名称
from (
select main_merchant_id ''4s店商户号'', main_merchant_name ''4s店商户名称'', sub_merchant_id ''园区店商户号'', sub_merchant_name ''园区店商户名称'',scene
from dj_car_life_scene_merchant_ref where deleted_flag = ''N''and scene in(0,1)and sub_merchant_type in (6,8)
)a inner join(
select merchant_id,partner_merchant_id 主服务商id,partner_merchant_name 主服务商名称 from dj_car_life_yqmerchant_config where deleted_flag = ''N''
)b on a.园区店商户号=b.merchant_id
inner join (
select staff_uuid 员工uuid,staff_name 员工姓名 ,phone_number 员工手机号,merchant_id 所属商户号,merchant_name 所属商户名称,
(case when phone_number in (select custodian_phone from inspection_asset_management ) then ''是''else ''否''end)是否派发平板
from dj_car_life_staff_info where deleted_flag = ''N''
)c on a.园区店商户号=c.所属商户号
)t group by 主服务商id,scene,员工uuid,4s店商户号
having 主服务商id is not null
)t1 on t0.员工id=t1.员工uuid and t0.4s店商户号=t1.4s店商户号 and t0.scene_type=t1.scene
-- 到店量数据来源: dj_car_life_staff_daily_report_huawei
left join(
select staff_uuid, 4s店店商户号,
ifnull(sum(ifnull(equity_to_shop_count,0) + ifnull(after_sale_equity_to_shop_count,0)), 0) 总触客
from (
select ifnull(员工手机号,t.staff_uuid) staff_uuid, merchant_id as 4s店店商户号,
equity_to_shop_count, after_sale_equity_to_shop_count, deleted_flag, report_date
from dj_car_life_staff_daily_report_huawei t
left join (
select staff_uuid 员工uuid, staff_name 员工姓名, phone_number 员工手机号 from dj_car_life_staff_info where deleted_flag = ''N''
) dclsi on t.staff_uuid = dclsi.员工uuid
) t
where deleted_flag = ''N''
and DATE_FORMAT(report_date, ''%Y-%m-%d'') between date_format(''starttimexxxxxx'', ''%Y-%m-%d'') and ''endtimexxxxxx''
group by 4s店店商户号, staff_uuid
) t2 on t0.4s店商户号 = t2.4s店店商户号 and t0.员工id = t2.staff_uuid
left join (
select staff_uuid ,
count(distinct date_format (reception_start_time,''%Y-%m-%d'')) as 接待天数
from (
select ifnull(员工手机号,rcf.staff_uuid)staff_uuid,reception_start_time
from reception_customer_info rcf
left join (
select staff_uuid 员工uuid,staff_name 员工姓名 ,phone_number 员工手机号 from dj_car_life_staff_info where deleted_flag = ''N''
)dclsi on rcf.staff_uuid=dclsi.员工uuid
LEFT JOIN inspection_badge_recordings t2 ON rcf.id = t2.reception_id where t2.recording_start_time is not null
)t
where date_format (reception_start_time,''%Y-%m-%d'')between date_format(''starttimexxxxxx'',''%Y-%m-%d'') and ''endtimexxxxxx''
group by staff_uuid
)t4 on t0.员工id=t4.staff_uuid
left join (
select staff_uuid ,bussiness_type, merchant_id,
count(1)接待次数
from (
select ifnull(员工手机号,rcf.staff_uuid)staff_uuid,(case when bussiness_type=2 then 1 when bussiness_type=1 then 0 end )bussiness_type, merchant_id,reception_start_time
from reception_customer_info rcf
left join (
select staff_uuid 员工uuid,staff_name 员工姓名 ,phone_number 员工手机号 from dj_car_life_staff_info where deleted_flag = ''N''
)dclsi on rcf.staff_uuid=dclsi.员工uuid
LEFT JOIN inspection_badge_recordings t2 ON rcf.id = t2.reception_id where t2.recording_start_time is not null
)t
where date_format (reception_start_time,''%Y-%m-%d'')between date_format(''starttimexxxxxx'',''%Y-%m-%d'') and ''endtimexxxxxx''
group by staff_uuid ,bussiness_type,merchant_id
)t5 on t0.4s店商户号=t5.merchant_id and t0.员工id=t5.staff_uuid and t0.scene_type=t5.bussiness_type
left join (
SELECT
t1.staff_uuid,(case when t1.bussiness_type=2 then 1 when t1.bussiness_type=1 then 0 end )bussiness_type,t1.merchant_id,
count(1) as ''接待次数'', AVG(t3.score) as 质检平均分
FROM (select ifnull(员工手机号,t1.staff_uuid)staff_uuid,bussiness_type,id,merchant_id,reception_start_time from reception_customer_info t1
left join ( select staff_uuid 员工uuid,staff_name 员工姓名 ,phone_number 员工手机号 from dj_car_life_staff_info where deleted_flag = ''N''
)dclsi on t1.staff_uuid=dclsi.员工uuid
) t1
LEFT JOIN inspection_badge_recordings t2 ON t1.id = t2.reception_id
LEFT JOIN inspection_conversation_batch t3 ON t2.id = t3.record_id
where t2.che_result_flag =2 and t3.score>20
and date_format (reception_start_time,''%Y-%m-%d'')between date_format(''starttimexxxxxx'',''%Y-%m-%d'') and ''endtimexxxxxx''
GROUP BY t1.staff_uuid, t1.bussiness_type, t1.merchant_id
)t6 on t0.4s店商户号=t6.merchant_id and t0.员工id=t6.staff_uuid and t0.scene_type=t6.bussiness_type
-- 派发日期关联查询
left join (
select custodian_phone, DATE_FORMAT(MAX(dis_date), ''%Y-%m-%d'') as 派发日期
from inspection_asset_management
where deleted_flag = ''N''
group by custodian_phone
) t7 on t1.员工手机号 = t7.custodian_phone
-- 【新增】系统报备数量关联查询
left join (
select staff_phone,
COUNT(*) as report_count,
SUM(CASE WHEN audit_status = 1 THEN 1 ELSE 0 END) as approved_count
from reception_missing_report
where deleted_flag = ''N''
and report_date between date_format(''starttimexxxxxx'', ''%Y-%m-%d'') and ''endtimexxxxxx''
group by staff_phone
) t8 on t1.员工手机号 = t8.staff_phone
having 门店 not in (''杰西集团的门店2'',''杰西集团的门店'',''内部测试4S店'')
',
'N',
NOW(),
'7月版本: 新增派发日期+报备数量字段 + 到店量切换到华为日报表');
-- 2.3 插入新版本 querySellerUserUsedipadAnalysis02
INSERT INTO `report_export_query_sql` (`sqlname`, `querysql`, `deleted_flag`, `created_date`, `ver_desc`)
VALUES (
'querySellerUserUsedipadAnalysis02',
'select 4s店商户号,员工id,场景 scene_type,业务类型,sum(日报有误天)日报有误天数 from(
select
ifnull(t.员工手机号,t.员工id)as 员工id , t.场景, t.4s店商户号, t.业务类型,员工手机号,订单数 ,ifnull(总触客,0) 到店量人,ifnull(t6.接待次数,0) 真实接待数量,
(case when 总触客 is null then 1 else (case when 总触客>ifnull(t6.接待次数,0) or ifnull(订单数,0)>总触客 then 1 else 0 end)end)日报有误天
from (
SELECT ifnull(员工手机号,员工id)员工id,统计时间,4s店商户号,场景,业务类型,员工手机号 FROM (
SELECT distinct t1.staff_uuid 员工id, DATE_FORMAT(t1.reception_start_time, ''%Y-%m-%d'') AS 统计时间,t1.merchant_id 4s店商户号,
(case when t1.bussiness_type=2 then 1 when t1.bussiness_type=1 then 0 end )场景, (case when t1.bussiness_type=2 then ''精品升级'' when t1.bussiness_type=1 then ''会员权益/升级'' else null end) 业务类型
FROM reception_customer_info t1
LEFT JOIN inspection_badge_recordings t2 ON t1.id = t2.reception_id
LEFT JOIN inspection_conversation_batch t3 ON t2.id = t3.record_id
where t2.che_result_flag =2 and t3.score>20
and date_format (reception_start_time,''%Y-%m-%d'')between date_format(''starttimexxxxxx'',''%Y-%m-%d'') and ''endtimexxxxxx''
GROUP BY t1.staff_uuid, t1.bussiness_type, t1.merchant_id,date_format (reception_start_time,''%Y-%m-%d'')
union
select distinct 员工id,统计时间,4s店商户号,scene_type 场景,业务类型 from (
select seller_user_id''员工id'',seller_name ''员工姓名'',dclgo.scene_type,merchant_id ''4s店商户号'' ,merchant_name ''4s店商户名称'',
(case when dclgo.scene_type=1 then ''精品升级'' when dclgo.scene_type=0 then ''会员权益/升级'' end) 业务类型,
DATE_FORMAT(dclgo.order_time,''%Y-%m-%d'')统计时间
from(
select ifnull(b.success_date,a.order_time) order_time ,a.merchant_id, a.merchant_name, a.seller_user_id,a.scene_type,a.seller_name,a.status, a.deleted_flag, a.upgrade_flag
from dj_car_life_goods_order a
left join (select * from dj_car_life_pay_order where deleted_flag = ''N'' and order_code is not null) b on a.order_code=b.order_code
) dclgo
where dclgo.deleted_flag=''N''and dclgo.status in (2, 4, 6)and dclgo.upgrade_flag in (''Y'',''N'')and seller_user_id is not null and scene_type in (0,1)
and DATE_FORMAT(dclgo.order_time,''%Y-%m-%d'') between date_format(''starttimexxxxxx'',''%Y-%m-%d'')and ''endtimexxxxxx''
)t group by 员工id,统计时间,4s店商户号,业务类型
union
select distinct staff_uuid 员工id,DATE_FORMAT(report_date,''%Y-%m-%d'')统计时间,merchant_id 4s店商户号,scene_type 场景, (case when scene_type=1 then ''精品升级'' when scene_type=0 then ''会员权益/升级'' else null end) 业务类型
from dj_car_life_staff_daily_report_huawei
where deleted_flag = ''N''
and DATE_FORMAT(report_date,''%Y-%m-%d'')between date_format(''starttimexxxxxx'',''%Y-%m-%d'') and ''endtimexxxxxx''
)tt
left join (
select staff_uuid 员工uuid,staff_name 员工姓名 ,phone_number 员工手机号 from dj_car_life_staff_info where deleted_flag = ''N''
)dclsi on tt.员工id=dclsi.员工uuid
)t left join (
select 员工id,4s店商户号,业务类型, scene_type,order_time,
员工姓名,4s店商户名称 as 门店,
sum(total_price) 产值,
count(distinct (case when upgrade_flag=''Y'' then order_code else null end))订单数
from (
select order_time,ifnull(员工手机号,seller_user_id)''员工id'',seller_name ''员工姓名'',dclgo.scene_type,merchant_id ''4s店商户号'',merchant_name ''4s店商户名称'',upgrade_flag,dclgo.order_code,dclgoc.customer_phone,total_price,
(case when dclgo.scene_type=1 then ''精品升级'' when dclgo.scene_type=0 then ''会员权益/升级'' else null end) 业务类型
from(
select ifnull(DATE_FORMAT(b.success_date,''%Y-%m-%d''),DATE_FORMAT(a.order_time,''%Y-%m-%d'')) order_time ,a.merchant_id, a.merchant_name,a.order_code,
a.seller_user_id,a.scene_type,a.business_type,a.seller_name,a.seller_merchant_id,a.seller_merchant_name,
a.status, a.deleted_flag, a.upgrade_flag,a.total_price
from dj_car_life_goods_order a
left join (
select * from dj_car_life_pay_order where deleted_flag = ''N'' and order_code is not null
) b on a.order_code=b.order_code
) dclgo
left join dj_car_life_goods_order_customer dclgoc on dclgo.order_code = dclgoc.order_code and dclgoc.deleted_flag = ''N''
left join ( select staff_uuid 员工uuid,staff_name 员工姓名 ,phone_number 员工手机号 from dj_car_life_staff_info where deleted_flag = ''N''
)dclsi on dclgo.seller_user_id=dclsi.员工uuid
where dclgo.deleted_flag=''N''
and dclgo.status in (2, 4, 6)
and dclgo.upgrade_flag in (''Y'',''N'')
and seller_user_id is not null
and scene_type in (0,1)
and order_time between date_format(''starttimexxxxxx'',''%Y-%m-%d'') and ''endtimexxxxxx''
)t group by 员工id,4s店商户号,业务类型,order_time
)t0 on t.4s店商户号=t0.4s店商户号 and t.员工id=t0.员工id and t.场景=t0.scene_type and t.统计时间=t0.order_time
left join(
select staff_uuid, 4s店店商户号, report_date,
ifnull(sum(ifnull(equity_to_shop_count,0) + ifnull(after_sale_equity_to_shop_count,0)), 0) 总触客
from (
select ifnull(员工手机号,t.staff_uuid) staff_uuid, merchant_id as 4s店店商户号,
DATE_FORMAT(report_date, ''%Y-%m-%d'') report_date,
equity_to_shop_count, after_sale_equity_to_shop_count, deleted_flag
from dj_car_life_staff_daily_report_huawei t
left join (
select staff_uuid 员工uuid, staff_name 员工姓名, phone_number 员工手机号 from dj_car_life_staff_info where deleted_flag = ''N''
) dclsi on t.staff_uuid = dclsi.员工uuid
) t
where deleted_flag = ''N''
and DATE_FORMAT(report_date, ''%Y-%m-%d'') between date_format(''starttimexxxxxx'', ''%Y-%m-%d'') and ''endtimexxxxxx''
group by 4s店店商户号, staff_uuid, report_date
) t2 on t.4s店商户号 = t2.4s店店商户号 and t.员工id = t2.staff_uuid and t.统计时间 = t2.report_date
left join (
SELECT
t1.staff_uuid, DATE_FORMAT(t1.reception_start_time, ''%Y-%m-%d'') AS 接待时间,
(case when t1.bussiness_type=2 then 1 when t1.bussiness_type=1 then 0 end )bussiness_type,
t1.merchant_id, count(1) as ''接待次数'', AVG(t3.score) as 质检平均分
FROM (
select ifnull(员工手机号,staff_uuid)staff_uuid,reception_start_time,bussiness_type,merchant_id,id from reception_customer_info rcf
left join ( select staff_uuid 员工uuid,staff_name 员工姓名 ,phone_number 员工手机号 from dj_car_life_staff_info where deleted_flag = ''N''
)dclsi on rcf.staff_uuid=dclsi.员工uuid
)t1
LEFT JOIN inspection_badge_recordings t2 ON t1.id = t2.reception_id
LEFT JOIN inspection_conversation_batch t3 ON t2.id = t3.record_id
where t2.che_result_flag =2 and t3.score>20
and date_format (reception_start_time,''%Y-%m-%d'')between date_format(''starttimexxxxxx'',''%Y-%m-%d'') and ''endtimexxxxxx''
GROUP BY t1.staff_uuid, t1.bussiness_type, t1.merchant_id,date_format (reception_start_time,''%Y-%m-%d'')
)t6 on t.4s店商户号=t6.merchant_id and t.员工id=t6.staff_uuid and t.场景=t6.bussiness_type and t.统计时间=t6.接待时间
)t group by 4s店商户号,员工id,scene_type',
'N',
NOW(),
'7月版本: 到店量切换到华为日报表');
### 章家宝 -----------------end--------------------