|
...
|
...
|
@@ -74,12 +74,18 @@ class TicketCount extends Command |
|
|
|
$manageHrModel = new ManageHr();
|
|
|
|
$manageList = $manageHrModel->list(['status'=>1,'dept_id'=>['in',[1,2]]],'id',['id','dept_id','manage_id','name','nickname']);
|
|
|
|
$date = Carbon::yesterday()->toDateString(); // 昨日时间
|
|
|
|
// 当月开始时间(零点)
|
|
|
|
$startOfMonth = Carbon::now()->startOfMonth()->toDateTimeString();
|
|
|
|
// 当月结束时间(最后一秒)
|
|
|
|
$endOfMonth = Carbon::now()->endOfMonth()->toDateTimeString();
|
|
|
|
$ticketManageCountModel = new TicketDailyManageCount();
|
|
|
|
foreach ($manageList as $item){
|
|
|
|
$average_time = null;
|
|
|
|
$this->output('按人员统计:执行的人员名称/id:'.$item['name'].'/'.$item['manage_id']);
|
|
|
|
$ticketLogModel = new TicketLog();
|
|
|
|
$ticket_num = $ticketLogModel->counts(['engineer_id'=>$item['manage_id'],'is_engineer'=>1]);
|
|
|
|
//当月工单总数
|
|
|
|
$month_ticket_num = $ticketLogModel->counts(['engineer_id'=>$item['manage_id'],'is_engineer'=>1,'created_at'=>['between',[$startOfMonth,$endOfMonth]]]);
|
|
|
|
//工单总时长
|
|
|
|
$timeCount = $ticketLogModel->formatQuery(['engineer_id'=>$item['manage_id'],'is_engineer'=>1])->sum('end_time');
|
|
|
|
$ticket_end_num = $ticketLogModel->counts(['engineer_id'=>$item['manage_id'],'is_engineer'=>1,'end_at'=>['!=',null]]);
|
|
...
|
...
|
@@ -103,7 +109,10 @@ class TicketCount extends Command |
|
|
|
'fastest_time'=>$fastest_time ?? null,//最快完成工单时间
|
|
|
|
'timeout_num'=>$timeout_num,//超时工单数量
|
|
|
|
'complete_num'=>$complete_num,//完成工单数量
|
|
|
|
'dept_id'=>$item['dept_id']
|
|
|
|
'dept_id'=>$item['dept_id'],
|
|
|
|
'month'=>$date('Y-m'),
|
|
|
|
'month_ticket_num'=>$month_ticket_num,
|
|
|
|
|
|
|
|
];
|
|
|
|
//查询当前用户是否当日已有记录
|
|
|
|
$ticketManageInfo = $ticketManageCountModel->read(['date'=>$date,'manage_id'=>$item['id']],['id']);
|
|
...
|
...
|
@@ -186,6 +195,10 @@ class TicketCount extends Command |
|
|
|
)
|
|
|
|
->groupBy('p.project_cate')
|
|
|
|
->pluck('ticket_count', 'project_cate');
|
|
|
|
$timeout_num = $ticketModel->counts(['end_at'=>null,'plan_end_at'=>['>',date('Y-m-d H:i:s')]]);
|
|
|
|
if(!empty($timeout_num)){
|
|
|
|
$timeout_ratio = round($timeout_num / $ticket_num, 2);
|
|
|
|
}
|
|
|
|
$data = [
|
|
|
|
'date' => $date,
|
|
|
|
'ticket_num'=>$ticket_num,
|
|
...
|
...
|
@@ -194,7 +207,9 @@ class TicketCount extends Command |
|
|
|
'processed_num'=>$processed_num,
|
|
|
|
'average_time'=>$average_time ?? null,
|
|
|
|
'source'=>json_encode(['a'=>$submit_a_side,'b'=>$submit_b_side],true),
|
|
|
|
'source_type'=>json_encode($dbResult,true)
|
|
|
|
'source_type'=>json_encode($dbResult,true),
|
|
|
|
'timeout_num'=>$timeout_num,
|
|
|
|
'timeout_ratio'=>$timeout_ratio ?? null
|
|
|
|
];
|
|
|
|
$ticketDailyModel = new TicketDailyCount();
|
|
|
|
$ticketDailyInfo = $ticketDailyModel->read(['date'=>$date],['id']);
|
...
|
...
|
|