|
|
|
|
@ -367,7 +367,7 @@ class OtherController extends CommonController
|
|
|
|
|
* tags={"其他"},
|
|
|
|
|
* summary="课程统计明细导出",
|
|
|
|
|
* 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-入学后上市公司明细, company_invested_after_enrollment_total-入学后被投企业明细, course_total-开课场次明细, course_day_total-开课天数明细, company_join_total-元和员工参与企业明细, company_ganbu_total-全市干部参与企业明细, cover_head_total-苏州头部企业明细, cover_rencai_total-高层次人才明细, cover_stock_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-入学后上市公司明细, company_invested_after_enrollment_total-入学后被投企业明细, company_invested_year_total-年份范围内被投企业明细, course_total-开课场次明细, course_day_total-开课天数明细, company_join_total-元和员工参与企业明细, company_ganbu_total-全市干部参与企业明细, cover_head_total-苏州头部企业明细, cover_rencai_total-高层次人才明细, cover_stock_total-重点上市公司明细"),
|
|
|
|
|
* @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="course_type_id", in="query", @OA\Schema(type="string"), required=false, description="课程体系id,多个英文逗号"),
|
|
|
|
|
@ -856,6 +856,92 @@ class OtherController extends CommonController
|
|
|
|
|
$filename = '入学后被投企业明细';
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'company_invested_year_total':
|
|
|
|
|
// 年份范围内被投企业明细 - 所有年份范围内被投企业,关联学员、课程信息
|
|
|
|
|
// 数据结构:主表是公司,子数据是学员信息
|
|
|
|
|
// 导出时:公司信息只在第一行显示,后续行公司信息为空
|
|
|
|
|
$companiesData = CourseSign::companyInvestedYear($start_date, $end_date, $course_ids->toArray(), true);
|
|
|
|
|
|
|
|
|
|
foreach ($companiesData as $item) {
|
|
|
|
|
$company = $item['company'];
|
|
|
|
|
$users = $item['users'] ?? [];
|
|
|
|
|
|
|
|
|
|
// 公司基本信息(只在第一行使用)
|
|
|
|
|
$companyInfo = [
|
|
|
|
|
'company_name' => $company->company_name,
|
|
|
|
|
'company_legal_representative' => $company->company_legal_representative ?? '',
|
|
|
|
|
'company_date' => $company->company_date ?? '',
|
|
|
|
|
'company_address' => $company->company_address ?? '',
|
|
|
|
|
'company_city' => $company->company_city ?? '',
|
|
|
|
|
'company_area' => $company->company_area ?? '',
|
|
|
|
|
'company_tag' => $company->company_tag ?? '',
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
if (empty($users)) {
|
|
|
|
|
// 如果没有学员报名记录,仍然导出公司基本信息
|
|
|
|
|
$data[] = array_merge($companyInfo, [
|
|
|
|
|
'user_name' => '',
|
|
|
|
|
'course_name' => '',
|
|
|
|
|
'course_type' => '',
|
|
|
|
|
]);
|
|
|
|
|
} else {
|
|
|
|
|
// 每个学员一行,多个课程合并显示
|
|
|
|
|
$isFirstRow = true;
|
|
|
|
|
foreach ($users as $userInfo) {
|
|
|
|
|
$courses = $userInfo['courses'] ?? [];
|
|
|
|
|
|
|
|
|
|
// 合并同一学员的多个课程:格式为"课程体系-课程名称,课程体系-课程名称"
|
|
|
|
|
$courseList = [];
|
|
|
|
|
foreach ($courses as $courseInfo) {
|
|
|
|
|
$courseType = $courseInfo['course_type'] ?? '';
|
|
|
|
|
$courseName = $courseInfo['course_name'] ?? '';
|
|
|
|
|
if ($courseType && $courseName) {
|
|
|
|
|
$courseList[] = $courseType . '-' . $courseName;
|
|
|
|
|
} elseif ($courseName) {
|
|
|
|
|
$courseList[] = $courseName;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$courseDisplay = implode("\r\n", $courseList);
|
|
|
|
|
|
|
|
|
|
if ($isFirstRow) {
|
|
|
|
|
// 第一行:显示公司信息
|
|
|
|
|
$data[] = array_merge($companyInfo, [
|
|
|
|
|
'user_name' => $userInfo['user_name'] ?? '',
|
|
|
|
|
'course_name' => $courseDisplay,
|
|
|
|
|
'course_type' => '', // 课程类型已合并到课程名称中
|
|
|
|
|
]);
|
|
|
|
|
$isFirstRow = false;
|
|
|
|
|
} else {
|
|
|
|
|
// 后续行:公司信息为空
|
|
|
|
|
$data[] = [
|
|
|
|
|
'company_name' => '',
|
|
|
|
|
'company_legal_representative' => '',
|
|
|
|
|
'company_date' => '',
|
|
|
|
|
'company_address' => '',
|
|
|
|
|
'company_city' => '',
|
|
|
|
|
'company_area' => '',
|
|
|
|
|
'company_tag' => '',
|
|
|
|
|
'user_name' => $userInfo['user_name'] ?? '',
|
|
|
|
|
'course_name' => $courseDisplay,
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$fields = [
|
|
|
|
|
'company_name' => '企业名称',
|
|
|
|
|
'company_legal_representative' => '法人',
|
|
|
|
|
'company_date' => '成立时间',
|
|
|
|
|
'company_address' => '地址',
|
|
|
|
|
'company_city' => '所在城市',
|
|
|
|
|
'company_area' => '所在区域',
|
|
|
|
|
'company_tag' => '企业资质',
|
|
|
|
|
'user_name' => '学员姓名',
|
|
|
|
|
'course_name' => '课程信息',
|
|
|
|
|
];
|
|
|
|
|
$filename = '年份范围内被投企业明细';
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'course_total':
|
|
|
|
|
// 开课场次明细 - 与coursesHome算法一致
|
|
|
|
|
$calendars = Calendar::whereBetween('date', [$start_date, $end_date])
|
|
|
|
|
|