master
cody 2 weeks ago
parent 7f4d81b1d9
commit 7b7cbf2685

@ -250,8 +250,6 @@ class OtherController extends CommonController
// 元和员工参与企业
$list['company_join_total'] = CourseSign::companyJoin($start_date, $end_date, $course_ids);
// 全市干部参与企业
$list['company_ganbu_total'] = CourseSign::ganbu($start_date, $end_date, $course_ids);
// 苏州头部企业
$list['cover_head_total'] = CourseSign::toubuqiye($start_date, $end_date, $course_ids);
// 高层次人才
@ -307,7 +305,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-入学后上市公司明细, course_total-开课场次明细, course_day_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-开课天数明细, 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多个英文逗号"),
@ -687,6 +685,156 @@ class OtherController extends CommonController
$filename = '开课天数明细';
break;
case 'company_join_total':
// 元和员工参与企业明细 - 使用模型方法
$companies = CourseSign::companyJoin($start_date, $end_date, $course_ids, true);
foreach ($companies as $company) {
$data[] = [
'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 ?? '',
'business_scope' => $company->business_scope ?? '',
'contact_phone' => $company->contact_phone ?? '',
'contact_mail' => $company->contact_mail ?? '',
'company_tag' => $company->company_tag ?? '',
'credit_code' => ' ' . $company->credit_code ?? '',
];
}
$fields = [
'company_name' => '企业名称',
'company_legal_representative' => '法人',
'company_date' => '成立时间',
'company_address' => '地址',
'company_city' => '所在城市',
'company_area' => '所在区域',
'business_scope' => '营业范围',
'contact_phone' => '联系电话',
'contact_mail' => '联系邮箱',
'company_tag' => '企业资质',
'credit_code' => '统一社会信用代码',
];
$filename = '元和员工参与企业明细';
break;
case 'company_ganbu_total':
// 全市干部参与企业明细 - 使用模型方法
$users = CourseSign::ganbu($start_date, $end_date, $course_ids, true);
foreach ($users as $user) {
$data[] = [
'user_name' => $user->name ?? '',
'mobile' => $user->mobile ?? '',
'company_name' => $user->company->company_name ?? '',
'company_area' => $user->company->company_area ?? '',
'company_city' => $user->company->company_city ?? '',
'company_position' => $user->company_position ?? '',
];
}
$fields = [
'user_name' => '学员姓名',
'mobile' => '手机号',
'company_name' => '企业名称',
'company_area' => '所在区域',
'company_city' => '所在城市',
'company_position' => '职位',
];
$filename = '全市干部参与企业明细';
break;
case 'cover_head_total':
// 苏州头部企业明细 - 使用模型方法
$companies = CourseSign::toubuqiye($start_date, $end_date, $course_ids, true);
foreach ($companies as $company) {
$data[] = [
'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 ?? '',
'business_scope' => $company->business_scope ?? '',
'contact_phone' => $company->contact_phone ?? '',
'contact_mail' => $company->contact_mail ?? '',
];
}
$fields = [
'company_name' => '企业名称',
'company_legal_representative' => '法人',
'company_date' => '成立时间',
'company_address' => '地址',
'company_city' => '所在城市',
'company_area' => '所在区域',
'company_tag' => '企业资质',
'business_scope' => '营业范围',
'contact_phone' => '联系电话',
'contact_mail' => '联系邮箱',
];
$filename = '苏州头部企业明细';
break;
case 'cover_rencai_total':
// 高层次人才明细 - 使用模型方法
$users = CourseSign::rencai($start_date, $end_date, $course_ids, true);
// 加载关联关系
$users->load('company');
foreach ($users as $user) {
$data[] = [
'user_name' => $user->name ?? '',
'mobile' => $user->mobile ?? '',
'company_name' => $user->company_name ?? '',
'company_area' => $user->company_area ?? '',
'company_city' => $user->company->company_city ?? '',
'company_position' => $user->company_position ?? '',
'education' => $user->education ?? '',
];
}
$fields = [
'user_name' => '学员姓名',
'mobile' => '手机号',
'company_name' => '企业名称',
'company_area' => '所在区域',
'company_city' => '所在城市',
'company_position' => '职位',
'education' => '学历',
];
$filename = '高层次人才明细';
break;
case 'cover_stock_total':
// 重点上市公司明细 - 使用模型方法
$companies = CourseSign::shangshi($start_date, $end_date, $course_ids, true);
foreach ($companies as $company) {
$data[] = [
'company_name' => $company->company_name,
'company_legal_representative' => $company->company_legal_representative ?? '',
'company_date' => $company->company_date ?? '',
'stock_date' => $company->stock_date ?? '',
'company_address' => $company->company_address ?? '',
'company_city' => $company->company_city ?? '',
'company_area' => $company->company_area ?? '',
'business_scope' => $company->business_scope ?? '',
'contact_phone' => $company->contact_phone ?? '',
'contact_mail' => $company->contact_mail ?? '',
];
}
$fields = [
'company_name' => '企业名称',
'company_legal_representative' => '法人',
'company_date' => '成立时间',
'stock_date' => '上市日期',
'company_address' => '地址',
'company_city' => '所在城市',
'company_area' => '所在区域',
'business_scope' => '营业范围',
'contact_phone' => '联系电话',
'contact_mail' => '联系邮箱',
];
$filename = '重点上市公司明细';
break;
default:
return $this->fail([ResponseCode::ERROR_PARAMETER, '不支持的导出类型']);
}

@ -379,7 +379,7 @@ class CourseSign extends SoftDeletesModel
$query->whereIn('id', $courseSignsQuery->get()->pluck('user_id'));
})->where('company_market', 1)->get();
if ($retList) {
return $list->get();
return $list;
} else {
return $list->count();
}

Loading…
Cancel
Save