|
|
|
|
@ -1701,7 +1701,10 @@ class OtherController extends CommonController
|
|
|
|
|
$companiesData = CourseSign::shangshi($start_date, $end_date, $course_ids, true);
|
|
|
|
|
foreach ($companiesData as $item) {
|
|
|
|
|
$company = $item['company'];
|
|
|
|
|
$data[] = [
|
|
|
|
|
$users = $item['users'] ?? [];
|
|
|
|
|
|
|
|
|
|
// 公司基本信息(只在第一行使用)
|
|
|
|
|
$companyInfo = [
|
|
|
|
|
'company_name' => $company->company_name,
|
|
|
|
|
'company_legal_representative' => $company->company_legal_representative ?? '',
|
|
|
|
|
'company_date' => $company->company_date ?? '',
|
|
|
|
|
@ -1709,10 +1712,74 @@ class OtherController extends CommonController
|
|
|
|
|
'company_address' => $company->company_address ?? '',
|
|
|
|
|
'company_city' => $company->company_city ?? '',
|
|
|
|
|
'company_area' => $company->company_area ?? '',
|
|
|
|
|
'company_tag' => $company->company_tag ?? '',
|
|
|
|
|
'business_scope' => $company->business_scope ?? '',
|
|
|
|
|
'contact_phone' => $company->contact_phone ?? '',
|
|
|
|
|
'contact_mail' => $company->contact_mail ?? '',
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
if (empty($users)) {
|
|
|
|
|
// 如果没有学员,仍然导出公司基本信息
|
|
|
|
|
$data[] = array_merge($companyInfo, [
|
|
|
|
|
'user_name' => '',
|
|
|
|
|
'course_names' => '',
|
|
|
|
|
'course_types' => '',
|
|
|
|
|
'course_count' => 0,
|
|
|
|
|
]);
|
|
|
|
|
} else {
|
|
|
|
|
// 每个学员一行
|
|
|
|
|
$isFirstRow = true;
|
|
|
|
|
foreach ($users as $userInfo) {
|
|
|
|
|
$user = $userInfo['user'] ?? null;
|
|
|
|
|
$courses = $userInfo['courses'] ?? [];
|
|
|
|
|
|
|
|
|
|
if (empty($courses)) {
|
|
|
|
|
// 如果没有课程,仍然显示学员信息
|
|
|
|
|
$courseNames = '';
|
|
|
|
|
$courseTypes = '';
|
|
|
|
|
$courseCount = 0;
|
|
|
|
|
} else {
|
|
|
|
|
// 收集课程名称
|
|
|
|
|
$courseNames = collect($courses)->pluck('course_name')->filter()->unique()->values()->implode('、');
|
|
|
|
|
|
|
|
|
|
// 收集课程体系
|
|
|
|
|
$courseTypes = collect($courses)->pluck('course_type')->filter()->unique()->values()->implode('、');
|
|
|
|
|
|
|
|
|
|
// 报名课程数
|
|
|
|
|
$courseCount = count($courses);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($isFirstRow) {
|
|
|
|
|
// 第一行:显示公司信息
|
|
|
|
|
$data[] = array_merge($companyInfo, [
|
|
|
|
|
'user_name' => $userInfo['user_name'] ?? ($user->name ?? ''),
|
|
|
|
|
'course_names' => $courseNames,
|
|
|
|
|
'course_types' => $courseTypes,
|
|
|
|
|
'course_count' => $courseCount,
|
|
|
|
|
]);
|
|
|
|
|
$isFirstRow = false;
|
|
|
|
|
} else {
|
|
|
|
|
// 后续行:公司信息为空
|
|
|
|
|
$data[] = [
|
|
|
|
|
'company_name' => '',
|
|
|
|
|
'company_legal_representative' => '',
|
|
|
|
|
'company_date' => '',
|
|
|
|
|
'stock_date' => '',
|
|
|
|
|
'company_address' => '',
|
|
|
|
|
'company_city' => '',
|
|
|
|
|
'company_area' => '',
|
|
|
|
|
'company_tag' => '',
|
|
|
|
|
'business_scope' => '',
|
|
|
|
|
'contact_phone' => '',
|
|
|
|
|
'contact_mail' => '',
|
|
|
|
|
'user_name' => $userInfo['user_name'] ?? ($user->name ?? ''),
|
|
|
|
|
'course_names' => $courseNames,
|
|
|
|
|
'course_types' => $courseTypes,
|
|
|
|
|
'course_count' => $courseCount,
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$fields = [
|
|
|
|
|
'company_name' => '企业名称',
|
|
|
|
|
@ -1722,9 +1789,14 @@ class OtherController extends CommonController
|
|
|
|
|
'company_address' => '地址',
|
|
|
|
|
'company_city' => '所在城市',
|
|
|
|
|
'company_area' => '所在区域',
|
|
|
|
|
'company_tag' => '企业资质',
|
|
|
|
|
'business_scope' => '营业范围',
|
|
|
|
|
'contact_phone' => '联系电话',
|
|
|
|
|
'contact_mail' => '联系邮箱',
|
|
|
|
|
'user_name' => '学员姓名',
|
|
|
|
|
'course_names' => '课程名称',
|
|
|
|
|
'course_types' => '课程体系',
|
|
|
|
|
'course_count' => '报名课程数',
|
|
|
|
|
];
|
|
|
|
|
$filename = '重点上市公司明细';
|
|
|
|
|
break;
|
|
|
|
|
|