|
|
|
|
@ -273,11 +273,7 @@ class OtherController extends CommonController
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 区域明细统计
|
|
|
|
|
$areas = ParameterDetail::where('parameter_id', 5)->get();
|
|
|
|
|
foreach ($areas as $area) {
|
|
|
|
|
$area->course_signs_pass = CourseSign::courseSignsTotal($start_date, $end_date, 1, $courses->pluck('id'), $area->value);
|
|
|
|
|
$area->course_signs_pass_unique = CourseSign::courseSignsTotalByUnique($start_date, $end_date, 1, $courses->pluck('id'), $area->value);
|
|
|
|
|
}
|
|
|
|
|
$areas = CourseSign::area($start_date, $end_date, 1, $courses->pluck('id'), true);
|
|
|
|
|
return $this->success(compact('list', 'courseTypesSum', 'areas'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -329,6 +325,9 @@ class OtherController extends CommonController
|
|
|
|
|
'company_address' => $company->company_address ?? '',
|
|
|
|
|
'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 = [
|
|
|
|
|
@ -338,6 +337,9 @@ class OtherController extends CommonController
|
|
|
|
|
'company_address' => '地址',
|
|
|
|
|
'business_scope' => '营业范围',
|
|
|
|
|
'contact_phone' => '联系电话',
|
|
|
|
|
'contact_mail' => '联系邮箱',
|
|
|
|
|
'company_tag' => '企业资质',
|
|
|
|
|
'credit_code' => '统一社会信用代码',
|
|
|
|
|
];
|
|
|
|
|
$filename = '被投企业明细';
|
|
|
|
|
break;
|
|
|
|
|
@ -384,7 +386,8 @@ class OtherController extends CommonController
|
|
|
|
|
'company_name' => $sign->user->company_name ?? '',
|
|
|
|
|
'company_area' => $sign->user->company_area ?? '',
|
|
|
|
|
'course_name' => $sign->course->name ?? '',
|
|
|
|
|
'created_at' => $sign->created_at ? $sign->created_at->format('Y-m-d H:i:s') : '',
|
|
|
|
|
'course_type' => $sign->course->typeDetail->name ?? '',
|
|
|
|
|
// 'created_at' => $sign->created_at ? $sign->created_at->format('Y-m-d H:i:s') : '',
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
$fields = [
|
|
|
|
|
@ -393,7 +396,8 @@ class OtherController extends CommonController
|
|
|
|
|
'company_name' => '企业名称',
|
|
|
|
|
'company_area' => '所在区域',
|
|
|
|
|
'course_name' => '课程名称',
|
|
|
|
|
'created_at' => '报名时间',
|
|
|
|
|
'course_type' => '课程类型',
|
|
|
|
|
// 'created_at' => '报名时间',
|
|
|
|
|
];
|
|
|
|
|
$filename = '审核通过人数明细';
|
|
|
|
|
break;
|
|
|
|
|
@ -401,13 +405,14 @@ class OtherController extends CommonController
|
|
|
|
|
case 'course_signs_pass_unique':
|
|
|
|
|
// 审核通过人数去重明细 - 使用courseSignsTotalByUnique方法获取列表
|
|
|
|
|
$users = CourseSign::courseSignsTotalByUnique($start_date, $end_date, 1, $course_ids, null, true);
|
|
|
|
|
|
|
|
|
|
foreach ($users as $user) {
|
|
|
|
|
// 获取该学员报名的课程列表(与coursesHome逻辑保持一致)
|
|
|
|
|
$userCourseSigns = CourseSign::where('user_id', $user->id)
|
|
|
|
|
->whereDate('created_at', '>=', $start_date)
|
|
|
|
|
->whereDate('created_at', '<=', $end_date)
|
|
|
|
|
->where('status', 1)
|
|
|
|
|
->whereHas('course', function ($query) use ($start_date, $end_date) {
|
|
|
|
|
// 开始结束日期的筛选。or查询
|
|
|
|
|
$query->whereBetween('start_date', [$start_date, $end_date])
|
|
|
|
|
->whereBetween('end_date', [$start_date, $end_date]);
|
|
|
|
|
})->where('status', 1)
|
|
|
|
|
->where(function ($query) use ($course_ids) {
|
|
|
|
|
if ($course_ids->isNotEmpty()) {
|
|
|
|
|
$query->whereIn('course_id', $course_ids);
|
|
|
|
|
@ -415,7 +420,7 @@ class OtherController extends CommonController
|
|
|
|
|
})->whereNotIn('status', [4, 5])
|
|
|
|
|
->with('course')
|
|
|
|
|
->get();
|
|
|
|
|
$courseNames = $userCourseSigns->pluck('course.name')->filter()->unique()->implode('、');
|
|
|
|
|
$courseNames = $userCourseSigns->pluck('course.name')->filter()->unique()->implode("\n\r");
|
|
|
|
|
|
|
|
|
|
$data[] = [
|
|
|
|
|
'user_name' => $user->name ?? '',
|
|
|
|
|
@ -466,27 +471,31 @@ class OtherController extends CommonController
|
|
|
|
|
|
|
|
|
|
case 'areas':
|
|
|
|
|
// 区域明细 - 导出course_signs_pass列表数据,附加区域信息
|
|
|
|
|
$courseSigns = CourseSign::courseSignsTotal($start_date, $end_date, 1, $course_ids, null, true);
|
|
|
|
|
$courseSigns = CourseSign::area($start_date, $end_date, 1, $courses->pluck('id'), false);
|
|
|
|
|
// 加载关联关系
|
|
|
|
|
$courseSigns->load(['user', 'course']);
|
|
|
|
|
$courseSigns->load(['user.company', 'course']);
|
|
|
|
|
|
|
|
|
|
foreach ($courseSigns as $sign) {
|
|
|
|
|
$data[] = [
|
|
|
|
|
'area_name' => $sign->user->company_area ?? '',
|
|
|
|
|
'company_name' => $sign->user->company->company_name ?? '',
|
|
|
|
|
'area_name' => $sign->user->company->company_area ?? '',
|
|
|
|
|
'company_city' => $sign->user->company->company_city ?? '',
|
|
|
|
|
'company_province' => $sign->user->company->company_province ?? '',
|
|
|
|
|
'user_name' => $sign->user->name ?? '',
|
|
|
|
|
'mobile' => $sign->user->mobile ?? '',
|
|
|
|
|
'company_name' => $sign->user->company_name ?? '',
|
|
|
|
|
'course_name' => $sign->course->name ?? '',
|
|
|
|
|
'created_at' => $sign->created_at ? $sign->created_at->format('Y-m-d H:i:s') : '',
|
|
|
|
|
// 'created_at' => $sign->created_at ? $sign->created_at->format('Y-m-d H:i:s') : '',
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
$fields = [
|
|
|
|
|
'area_name' => '区域名称',
|
|
|
|
|
'company_name' => '企业名称',
|
|
|
|
|
'company_area' => '公司区域',
|
|
|
|
|
'company_city' => '公司城市',
|
|
|
|
|
'company_province' => '公司省份',
|
|
|
|
|
'user_name' => '学员姓名',
|
|
|
|
|
'mobile' => '手机号',
|
|
|
|
|
'company_name' => '企业名称',
|
|
|
|
|
'course_name' => '课程名称',
|
|
|
|
|
'created_at' => '报名时间',
|
|
|
|
|
// 'created_at' => '报名时间',
|
|
|
|
|
];
|
|
|
|
|
$filename = '区域明细';
|
|
|
|
|
break;
|
|
|
|
|
@ -567,11 +576,11 @@ class OtherController extends CommonController
|
|
|
|
|
|
|
|
|
|
case 'company_market_after_enrollment_total':
|
|
|
|
|
// 入学后上市公司明细 - 使用模型方法
|
|
|
|
|
$companiesAfterEnrollment = CourseSign::companyMarketAfterEnrollment($start_date, $end_date, $course_ids->toArray(), true);
|
|
|
|
|
$companiesAfterEnrollment = CourseSign::companyMarketAfterEnrollment($start_date, $end_date, $course_ids, true);
|
|
|
|
|
|
|
|
|
|
foreach ($companiesAfterEnrollment as $item) {
|
|
|
|
|
$company = $item['company'];
|
|
|
|
|
$userNames = collect($item['users'])->pluck('name')->filter()->unique()->implode('、');
|
|
|
|
|
$userNames = collect($item['users'])->pluck('name')->filter()->unique()->implode("\n\r");
|
|
|
|
|
$data[] = [
|
|
|
|
|
'company_name' => $company->company_name,
|
|
|
|
|
'company_legal_representative' => $company->company_legal_representative ?? '',
|
|
|
|
|
|