finish
This commit is contained in:
parent
8831588cdf
commit
fb9b11a57c
|
|
@ -179,19 +179,26 @@ class Kpidispatcher extends Backend
|
||||||
$orderValid = implode(',',$this->model->tabStatus(Order::TAB_VALID));
|
$orderValid = implode(',',$this->model->tabStatus(Order::TAB_VALID));
|
||||||
|
|
||||||
//"COUNT(CASE WHEN status IN (".$orderValid.") THEN 1 END) AS ing_num",
|
//"COUNT(CASE WHEN status IN (".$orderValid.") THEN 1 END) AS ing_num",
|
||||||
|
|
||||||
$fields = [
|
$fields = [
|
||||||
'dispatch_admin_id',
|
'dispatch_admin_id',
|
||||||
'worker_num',
|
'worker_num',
|
||||||
// 使用 IFNULL 确保结果为 null 时返回 0
|
// 完成数
|
||||||
"IFNULL(COUNT(CASE WHEN status = 60 THEN 1 END), 0) AS finish_num", //完成数
|
"COUNT(CASE WHEN status = 60 THEN 1 END) AS finish_num",
|
||||||
"IFNULL(COUNT(CASE WHEN status IN (".$orderValid.") THEN 1 END), 0) AS count_num", //总订单数 (排除取消 和草稿)
|
// 总订单数(排除取消和草稿)
|
||||||
"IFNULL(SUM(CASE WHEN status = 60 THEN total END), 0) AS total", //成效额
|
"COUNT(CASE WHEN status IN (".$orderValid.") THEN 1 END) AS count_num",
|
||||||
"IFNULL(SUM(CASE WHEN status = 60 THEN performance END), 0) AS performance", //业绩
|
// 成效额
|
||||||
"IFNULL(SUM(CASE WHEN status = 60 THEN (cost + material_cost) END), 0) AS cost_total", //总成本
|
"IFNULL(SUM(CASE WHEN status = 60 THEN total END), 0) AS total",
|
||||||
"IFNULL(SUM(CASE WHEN status = 60 THEN (refund_amount + worker_refund_amount) END), 0) AS refund_total", //退款总数
|
// 业绩
|
||||||
"IFNULL(COUNT(CASE WHEN refund_amount > 0 OR worker_refund_amount > 0 THEN 1 END), 0) AS refund_count", //退款订单数量
|
"IFNULL(SUM(CASE WHEN status = 60 THEN performance END), 0) AS performance",
|
||||||
"IFNULL(AVG(CASE WHEN status > 10 THEN UNIX_TIMESTAMP(dispatch_time) - UNIX_TIMESTAMP(create_time) END), 0) AS avg_time_diff", //派单时效
|
// 总成本
|
||||||
// "SUM(CASE WHEN status = 60 THEN (field1 + field2) END) AS performance",
|
"IFNULL(SUM(CASE WHEN status = 60 THEN (cost + material_cost) END), 0) AS cost_total",
|
||||||
|
// 退款总数
|
||||||
|
"IFNULL(SUM(CASE WHEN status = 60 THEN (refund_amount + worker_refund_amount) END), 0) AS refund_total",
|
||||||
|
// 退款订单数量
|
||||||
|
"COUNT(CASE WHEN refund_amount > 0 OR worker_refund_amount > 0 THEN 1 END) AS refund_count",
|
||||||
|
// 派单时效(过滤状态大于10)
|
||||||
|
"IFNULL(AVG(CASE WHEN status > 10 THEN UNIX_TIMESTAMP(dispatch_time) - UNIX_TIMESTAMP(create_time) END), 0) AS avg_time_diff",
|
||||||
];
|
];
|
||||||
|
|
||||||
$builder = $this->model
|
$builder = $this->model
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user