|
|
|
|
@ -240,6 +240,20 @@ class OtherController extends CommonController
|
|
|
|
|
$list['course_total'] = $calendar->count();
|
|
|
|
|
// 开课天数
|
|
|
|
|
$list['course_day_total'] = $calendar->sum('days');
|
|
|
|
|
|
|
|
|
|
// 上市公司数(所有上市公司)
|
|
|
|
|
$list['company_market_total'] = Company::companyMarket($start_date, $end_date);
|
|
|
|
|
|
|
|
|
|
// 跟班学员数(在指定时间范围内报名的学员中,from为'跟班学员'的数量)
|
|
|
|
|
$course_ids = $courses->pluck('id');
|
|
|
|
|
$list['ganbu_total'] = CourseSign::ganbu($start_date, $end_date, $course_ids);
|
|
|
|
|
|
|
|
|
|
// 今年上市公司数量(stock_date在今年)
|
|
|
|
|
$list['company_market_year_total'] = Company::companyMarketYear($start_date, $end_date, $course_ids);
|
|
|
|
|
|
|
|
|
|
// 入学后上市公司数量(在指定时间范围内报名的学员所在公司中,在入学后上市的公司数量)
|
|
|
|
|
$list['company_market_after_enrollment_total'] = CourseSign::companyMarketAfterEnrollment($start_date, $end_date, $course_ids);
|
|
|
|
|
|
|
|
|
|
// 课程分类明细统计
|
|
|
|
|
$courseTypesSum = [];
|
|
|
|
|
$courseTypes = CourseType::whereIn('id', $course_type_id)->get();
|
|
|
|
|
@ -273,7 +287,7 @@ class OtherController extends CommonController
|
|
|
|
|
* tags={"其他"},
|
|
|
|
|
* summary="课程统计明细导出",
|
|
|
|
|
* description="导出课程统计数据的明细",
|
|
|
|
|
* @OA\Parameter(name="export_type", in="query", @OA\Schema(type="string"), required=true, description="导出类型:invested_companies-被投企业明细, course_signs_total-报名人数明细, course_signs_pass-审核通过人数明细, course_signs_pass_unique-审核通过人数去重明细, course_types-课程分类明细, areas-区域明细"),
|
|
|
|
|
* @OA\Parameter(name="export_type", in="query", @OA\Schema(type="string"), required=true, description="导出类型:invested_companies-被投企业明细, course_signs_total-报名人数明细, course_signs_pass-审核通过人数明细, course_signs_pass_unique-审核通过人数去重明细, course_types-课程分类明细, areas-区域明细, company_market-上市公司明细, ganbu-跟班学员明细, company_market_year-今年上市公司明细, company_market_after_enrollment-入学后上市公司明细"),
|
|
|
|
|
* @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,多个英文逗号"),
|
|
|
|
|
@ -468,6 +482,128 @@ class OtherController extends CommonController
|
|
|
|
|
$filename = '区域明细';
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'company_market':
|
|
|
|
|
// 上市公司明细 - 所有上市公司
|
|
|
|
|
$companies = Company::companyMarket($start_date, $end_date, 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 ?? '',
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
$fields = [
|
|
|
|
|
'company_name' => '企业名称',
|
|
|
|
|
'company_legal_representative' => '法人',
|
|
|
|
|
'company_date' => '成立时间',
|
|
|
|
|
'stock_date' => '上市日期',
|
|
|
|
|
'company_address' => '地址',
|
|
|
|
|
'company_city' => '营业范围',
|
|
|
|
|
'company_area' => '联系电话',
|
|
|
|
|
];
|
|
|
|
|
$filename = '上市公司明细';
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'ganbu':
|
|
|
|
|
// 跟班学员明细 - 使用模型方法
|
|
|
|
|
$users = CourseSign::ganbu($start_date, $end_date, $course_ids, true);
|
|
|
|
|
|
|
|
|
|
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[] = [
|
|
|
|
|
'user_name' => $user->name ?? '',
|
|
|
|
|
'mobile' => $user->mobile ?? '',
|
|
|
|
|
'company_name' => $user->company_name ?? '',
|
|
|
|
|
'company_area' => $user->company_area ?? '',
|
|
|
|
|
'company_industry' => $user->company_industry ?? '',
|
|
|
|
|
'course_names' => $courseNames,
|
|
|
|
|
'course_count' => $userCourseSigns->count(),
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
$fields = [
|
|
|
|
|
'user_name' => '学员姓名',
|
|
|
|
|
'mobile' => '手机号',
|
|
|
|
|
'company_name' => '企业名称',
|
|
|
|
|
'company_area' => '所在区域',
|
|
|
|
|
'company_industry' => '所属行业',
|
|
|
|
|
'course_names' => '报名课程',
|
|
|
|
|
'course_count' => '报名课程数',
|
|
|
|
|
];
|
|
|
|
|
$filename = '跟班学员明细';
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'company_market_year':
|
|
|
|
|
// 今年上市公司明细 - 使用模型方法
|
|
|
|
|
$companies = Company::companyMarketYear($start_date, $end_date,null, 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 ?? '',
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
$fields = [
|
|
|
|
|
'company_name' => '企业名称',
|
|
|
|
|
'company_legal_representative' => '法人',
|
|
|
|
|
'company_date' => '成立时间',
|
|
|
|
|
'stock_date' => '上市日期',
|
|
|
|
|
'company_address' => '地址',
|
|
|
|
|
'company_city' => '营业范围',
|
|
|
|
|
'company_area' => '联系电话',
|
|
|
|
|
];
|
|
|
|
|
$filename = '今年上市公司明细';
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'company_market_after_enrollment':
|
|
|
|
|
// 入学后上市公司明细 - 使用模型方法
|
|
|
|
|
$companiesAfterEnrollment = CourseSign::companyMarketAfterEnrollment($start_date, $end_date, $course_ids->toArray(), true);
|
|
|
|
|
|
|
|
|
|
foreach ($companiesAfterEnrollment as $item) {
|
|
|
|
|
$company = $item['company'];
|
|
|
|
|
$userNames = collect($item['users'])->pluck('name')->filter()->unique()->implode('、');
|
|
|
|
|
$data[] = [
|
|
|
|
|
'company_name' => $company->company_name,
|
|
|
|
|
'company_legal_representative' => $company->company_legal_representative ?? '',
|
|
|
|
|
'company_date' => $company->company_date ?? '',
|
|
|
|
|
'stock_date' => $company->stock_date ?? '',
|
|
|
|
|
'first_sign_date' => $item['first_sign_date'],
|
|
|
|
|
'user_names' => $userNames,
|
|
|
|
|
'company_address' => $company->company_address ?? '',
|
|
|
|
|
'company_city' => $company->company_city ?? '',
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
$fields = [
|
|
|
|
|
'company_name' => '企业名称',
|
|
|
|
|
'company_legal_representative' => '法人',
|
|
|
|
|
'company_date' => '成立时间',
|
|
|
|
|
'stock_date' => '上市日期',
|
|
|
|
|
'first_sign_date' => '首次报名时间',
|
|
|
|
|
'user_names' => '学员姓名',
|
|
|
|
|
'company_address' => '地址',
|
|
|
|
|
'company_city' => '所在城市',
|
|
|
|
|
];
|
|
|
|
|
$filename = '入学后上市公司明细';
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
return $this->fail([ResponseCode::ERROR_PARAMETER, '不支持的导出类型']);
|
|
|
|
|
}
|
|
|
|
|
|