|
|
|
|
@ -191,6 +191,9 @@ class UserController extends BaseController
|
|
|
|
|
{
|
|
|
|
|
$all = request()->all();
|
|
|
|
|
$year = request('year', date('Y'));
|
|
|
|
|
$start_date = $year . '-01-01';
|
|
|
|
|
$end_date = $year . '-12-31';
|
|
|
|
|
|
|
|
|
|
$list = $this->model->with('appointments', 'companyIndustryDetail',
|
|
|
|
|
'companyPositionDetail', 'companyAreaDetail')
|
|
|
|
|
->with(['courseSigns' => function ($query) {
|
|
|
|
|
@ -328,22 +331,14 @@ class UserController extends BaseController
|
|
|
|
|
$list = $list->limit(5000)->get()->toArray();
|
|
|
|
|
return Excel::download(new CommonExport($list, $all['export_fields'] ?? ''), $all['file_name'] ?? '' . date('YmdHis') . '.xlsx');
|
|
|
|
|
} else {
|
|
|
|
|
$total = $this->model->whereHas('courseSigns')->count();
|
|
|
|
|
$year_total = $this->model->whereHas('courseSigns', function ($query) use ($year) {
|
|
|
|
|
$query->whereHas('course', function ($q) use ($year) {
|
|
|
|
|
$q->where('year', $year);
|
|
|
|
|
});
|
|
|
|
|
})->count();
|
|
|
|
|
// 累计总数
|
|
|
|
|
$total = CourseSign::courseSignsTotalByUnique('2020-01-01', date('Y-m-d'));
|
|
|
|
|
// 报名人数
|
|
|
|
|
$year_total = CourseSign::courseSignsTotalByUnique($start_date, $end_date);
|
|
|
|
|
// 年度培养学员
|
|
|
|
|
$year_training_total = $this->model->whereHas('courseSigns', function ($query) use ($year) {
|
|
|
|
|
$query->where('status', 1)->whereHas('course', function ($q) use ($year) {
|
|
|
|
|
$q->where('year', $year);
|
|
|
|
|
});
|
|
|
|
|
})->count();
|
|
|
|
|
$year_training_total = CourseSign::courseSignsTotalByUnique($start_date, $end_date, 1);
|
|
|
|
|
// 累计培养学员
|
|
|
|
|
$training_total = $this->model->whereHas('courseSigns', function ($query) use ($year) {
|
|
|
|
|
$query->where('status', 1);
|
|
|
|
|
})->count();
|
|
|
|
|
$training_total = CourseSign::courseSignsTotalByUnique('2020-01-01', date('Y-m-d'), 1);
|
|
|
|
|
$list = $list->paginate($all['page_size'] ?? 20);
|
|
|
|
|
}
|
|
|
|
|
return $this->success(['list' => $list, 'year_total' => $year_total, 'total' => $total, 'year_training_total' => $year_training_total, 'training_total' => $training_total]);
|
|
|
|
|
|