|
|
|
@ -287,7 +287,7 @@ class OtherController extends CommonController
|
|
|
|
* tags={"其他"},
|
|
|
|
* tags={"其他"},
|
|
|
|
* summary="课程统计明细导出",
|
|
|
|
* summary="课程统计明细导出",
|
|
|
|
* description="导出课程统计数据的明细",
|
|
|
|
* description="导出课程统计数据的明细",
|
|
|
|
* @OA\Parameter(name="export_type", in="query", @OA\Schema(type="string"), required=true, description="导出类型:course_signs_invested-被投企业明细, course_signs_total-报名人数明细, course_signs_pass-审核通过人数明细, course_signs_pass_unique-审核通过人数去重明细, courseTypesSum-课程分类明细, areas-区域明细, company_market_total-上市公司明细, ganbu_total-跟班学员明细, company_market_year_total-今年上市公司明细, company_market_after_enrollment_total-入学后上市公司明细"),
|
|
|
|
* @OA\Parameter(name="export_type", in="query", @OA\Schema(type="string"), required=true, description="导出类型:course_signs_invested-被投企业明细, course_signs_total-报名人数明细, course_signs_pass-审核通过人数明细, course_signs_pass_unique-审核通过人数去重明细, courseTypesSum-课程分类明细, areas-区域明细, company_market_total-上市公司明细, ganbu_total-跟班学员明细, company_market_year_total-今年上市公司明细, company_market_after_enrollment_total-入学后上市公司明细, course_total-开课场次明细, course_day_total-开课天数明细"),
|
|
|
|
* @OA\Parameter(name="start_date", in="query", @OA\Schema(type="string"), required=false, description="开始日期"),
|
|
|
|
* @OA\Parameter(name="start_date", in="query", @OA\Schema(type="string"), required=false, description="开始日期"),
|
|
|
|
* @OA\Parameter(name="end_date", in="query", @OA\Schema(type="string"), required=false, description="结束日期"),
|
|
|
|
* @OA\Parameter(name="end_date", in="query", @OA\Schema(type="string"), required=false, description="结束日期"),
|
|
|
|
* @OA\Parameter(name="course_type_id", in="query", @OA\Schema(type="string"), required=false, description="课程体系id,多个英文逗号"),
|
|
|
|
* @OA\Parameter(name="course_type_id", in="query", @OA\Schema(type="string"), required=false, description="课程体系id,多个英文逗号"),
|
|
|
|
@ -511,38 +511,21 @@ class OtherController extends CommonController
|
|
|
|
case 'ganbu_total':
|
|
|
|
case 'ganbu_total':
|
|
|
|
// 跟班学员明细 - 使用模型方法
|
|
|
|
// 跟班学员明细 - 使用模型方法
|
|
|
|
$users = CourseSign::ganbu($start_date, $end_date, $course_ids, true);
|
|
|
|
$users = CourseSign::ganbu($start_date, $end_date, $course_ids, true);
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($users as $user) {
|
|
|
|
foreach ($users as $user) {
|
|
|
|
$userCourseSigns = CourseSign::where('user_id', $user->id)
|
|
|
|
|
|
|
|
->whereDate('created_at', '>=', $start_date)
|
|
|
|
|
|
|
|
->whereDate('created_at', '<=', $end_date)
|
|
|
|
|
|
|
|
->where(function ($query) use ($course_ids) {
|
|
|
|
|
|
|
|
if ($course_ids->isNotEmpty()) {
|
|
|
|
|
|
|
|
$query->whereIn('course_id', $course_ids);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})->whereNotIn('status', [4, 5])
|
|
|
|
|
|
|
|
->with('course')
|
|
|
|
|
|
|
|
->get();
|
|
|
|
|
|
|
|
$courseNames = $userCourseSigns->pluck('course.name')->filter()->unique()->implode('、');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$data[] = [
|
|
|
|
$data[] = [
|
|
|
|
'user_name' => $user->name ?? '',
|
|
|
|
'name' => $user->username ?? '',
|
|
|
|
|
|
|
|
'sex' => $user->sex ?? '',
|
|
|
|
'mobile' => $user->mobile ?? '',
|
|
|
|
'mobile' => $user->mobile ?? '',
|
|
|
|
'company_name' => $user->company_name ?? '',
|
|
|
|
'company_name' => $user->company_name ?? '',
|
|
|
|
'company_area' => $user->company_area ?? '',
|
|
|
|
'company_position' => $user->company_position ?? '',
|
|
|
|
'company_industry' => $user->company_industry ?? '',
|
|
|
|
|
|
|
|
'course_names' => $courseNames,
|
|
|
|
|
|
|
|
'course_count' => $userCourseSigns->count(),
|
|
|
|
|
|
|
|
];
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$fields = [
|
|
|
|
$fields = [
|
|
|
|
'user_name' => '学员姓名',
|
|
|
|
'user_name' => '姓名',
|
|
|
|
|
|
|
|
'sex' => '性别',
|
|
|
|
'mobile' => '手机号',
|
|
|
|
'mobile' => '手机号',
|
|
|
|
'company_name' => '企业名称',
|
|
|
|
'company_name' => '企业名称',
|
|
|
|
'company_area' => '所在区域',
|
|
|
|
'company_position' => '职位',
|
|
|
|
'company_industry' => '所属行业',
|
|
|
|
|
|
|
|
'course_names' => '报名课程',
|
|
|
|
|
|
|
|
'course_count' => '报名课程数',
|
|
|
|
|
|
|
|
];
|
|
|
|
];
|
|
|
|
$filename = '跟班学员明细';
|
|
|
|
$filename = '跟班学员明细';
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
@ -604,6 +587,64 @@ class OtherController extends CommonController
|
|
|
|
$filename = '入学后上市公司明细';
|
|
|
|
$filename = '入学后上市公司明细';
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 'course_total':
|
|
|
|
|
|
|
|
// 开课场次明细 - 与coursesHome算法一致
|
|
|
|
|
|
|
|
$calendars = Calendar::whereIn('course_id', $course_ids)
|
|
|
|
|
|
|
|
->whereBetween('date', [$start_date, $end_date])
|
|
|
|
|
|
|
|
->with('course')
|
|
|
|
|
|
|
|
->get();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($calendars as $calendar) {
|
|
|
|
|
|
|
|
$data[] = [
|
|
|
|
|
|
|
|
'course_name' => $calendar->course->name ?? '',
|
|
|
|
|
|
|
|
'title' => $calendar->title ?? '',
|
|
|
|
|
|
|
|
'date' => $calendar->date ?? '',
|
|
|
|
|
|
|
|
'start_time' => $calendar->start_time,
|
|
|
|
|
|
|
|
'end_time' => $calendar->end_time,
|
|
|
|
|
|
|
|
'address' => $calendar->address ?? '',
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$fields = [
|
|
|
|
|
|
|
|
'course_name' => '课程名称',
|
|
|
|
|
|
|
|
'title' => '标题',
|
|
|
|
|
|
|
|
'date' => '日期',
|
|
|
|
|
|
|
|
'start_time' => '开始时间',
|
|
|
|
|
|
|
|
'end_time' => '结束时间',
|
|
|
|
|
|
|
|
'address' => '地址',
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
$filename = '开课场次明细';
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 'course_day_total':
|
|
|
|
|
|
|
|
// 开课天数明细 - 与coursesHome算法一致
|
|
|
|
|
|
|
|
$calendars = Calendar::whereIn('course_id', $course_ids)
|
|
|
|
|
|
|
|
->whereBetween('date', [$start_date, $end_date])
|
|
|
|
|
|
|
|
->with('course')
|
|
|
|
|
|
|
|
->get();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($calendars as $calendar) {
|
|
|
|
|
|
|
|
$data[] = [
|
|
|
|
|
|
|
|
'course_name' => $calendar->course->name ?? '',
|
|
|
|
|
|
|
|
'title' => $calendar->title ?? '',
|
|
|
|
|
|
|
|
'date' => $calendar->date ?? '',
|
|
|
|
|
|
|
|
'start_time' => $calendar->start_time ? date('Y-m-d H:i:s', strtotime($calendar->start_time)) : '',
|
|
|
|
|
|
|
|
'end_time' => $calendar->end_time ? date('Y-m-d H:i:s', strtotime($calendar->end_time)) : '',
|
|
|
|
|
|
|
|
'days' => $calendar->days ?? 0,
|
|
|
|
|
|
|
|
'address' => $calendar->address ?? '',
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$fields = [
|
|
|
|
|
|
|
|
'course_name' => '课程名称',
|
|
|
|
|
|
|
|
'title' => '标题',
|
|
|
|
|
|
|
|
'date' => '日期',
|
|
|
|
|
|
|
|
'start_time' => '开始时间',
|
|
|
|
|
|
|
|
'end_time' => '结束时间',
|
|
|
|
|
|
|
|
'days' => '天数',
|
|
|
|
|
|
|
|
'address' => '地址',
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
$filename = '开课天数明细';
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
return $this->fail([ResponseCode::ERROR_PARAMETER, '不支持的导出类型']);
|
|
|
|
return $this->fail([ResponseCode::ERROR_PARAMETER, '不支持的导出类型']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|