SELECT

a.consume_code consumeCode,

p.serv_order_code servOrderCode,

p.status_datetime exOrderDate,

f.user_name userName,

h.hf_date hfDate,

CASE

WHEN (

unix_timestamp(h.hf_date) - unix_timestamp(p.status_datetime)

) / 60 > 120 THEN

1

ELSE

0

END isfalg,

 CASE

WHEN (

unix_timestamp(h.hf_date) - unix_timestamp(p.status_datetime)

) / 60 > 120 THEN

round(

(

(

unix_timestamp(h.hf_date) - unix_timestamp(p.status_datetime)

) / 60

) - 120

)

ELSE

0

END intime

FROM

rs_sale_order_base a

INNER JOIN hf_info h ON a.consume_code = h.consume_code

LEFT JOIN rs_order_plat_serial p ON p.order_code = a.consume_code

LEFT JOIN ru_staff_op f ON f.op_id = h.hf_staff_id

WHERE

p.plat_status = 'P0I'

AND p.order_type = '1'

AND a.is_hf_flag = '1'

ORDER BY

h.hf_date DESC;


本示列查询客服信息如果在签到日期和客服回访时间相减,如果时间相减在二个小时之内,表示为及时,否则为不及时,不及时超出的时间是多少。