|
|
|
|
@ -1176,6 +1176,43 @@ class OtherController extends CommonController
|
|
|
|
|
// 加载关联关系
|
|
|
|
|
$users->load('company');
|
|
|
|
|
foreach ($users as $user) {
|
|
|
|
|
// 获取该学员的课程报名记录
|
|
|
|
|
$userCourseSigns = CourseSign::where(function ($query) use ($course_ids) {
|
|
|
|
|
// status = 1
|
|
|
|
|
$query->where('status', 1);
|
|
|
|
|
// course_ids筛选
|
|
|
|
|
if ($course_ids && $course_ids->isNotEmpty()) {
|
|
|
|
|
$query->whereIn('course_id', $course_ids);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
->whereHas('course', function ($query) use ($start_date, $end_date) {
|
|
|
|
|
$query->where('is_chart', 1);
|
|
|
|
|
// 开始结束日期的筛选。or查询
|
|
|
|
|
if ($start_date && $end_date) {
|
|
|
|
|
$query->where(function ($q) use ($start_date, $end_date) {
|
|
|
|
|
$q->whereBetween('start_date', [$start_date, $end_date])
|
|
|
|
|
->orWhereBetween('end_date', [$start_date, $end_date]);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
->whereNotIn('status', [4, 5, 6])
|
|
|
|
|
->where('user_id', $user->id)
|
|
|
|
|
->with(['course.typeDetail'])
|
|
|
|
|
->get();
|
|
|
|
|
|
|
|
|
|
// 获取课程名称列表,用中文顿号分隔
|
|
|
|
|
$courseNames = $userCourseSigns->pluck('course.name')->filter()->unique()->values()->implode('、');
|
|
|
|
|
|
|
|
|
|
// 获取课程体系列表,用中文顿号分隔
|
|
|
|
|
$courseTypes = $userCourseSigns->pluck('course.typeDetail.name')
|
|
|
|
|
->filter()
|
|
|
|
|
->unique()
|
|
|
|
|
->values()
|
|
|
|
|
->implode('、');
|
|
|
|
|
|
|
|
|
|
// 报名课程数
|
|
|
|
|
$courseCount = $userCourseSigns->count();
|
|
|
|
|
|
|
|
|
|
$data[] = [
|
|
|
|
|
'user_name' => $user->name ?? '',
|
|
|
|
|
'mobile' => $user->mobile ?? '',
|
|
|
|
|
@ -1186,6 +1223,9 @@ class OtherController extends CommonController
|
|
|
|
|
'company_legal_representative' => $user->company->company_legal_representative ?? '',
|
|
|
|
|
'company_date' => $user->company->company_date ?? '',
|
|
|
|
|
'company_address' => $user->company->company_address ?? '',
|
|
|
|
|
'course_names' => $courseNames,
|
|
|
|
|
'course_types' => $courseTypes,
|
|
|
|
|
'course_count' => $courseCount,
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
$fields = [
|
|
|
|
|
@ -1198,6 +1238,9 @@ class OtherController extends CommonController
|
|
|
|
|
'company_legal_representative' => '法人',
|
|
|
|
|
'company_date' => '成立时间',
|
|
|
|
|
'company_address' => '地址',
|
|
|
|
|
'course_names' => '课程名称',
|
|
|
|
|
'course_types' => '课程体系',
|
|
|
|
|
'course_count' => '报名课程数',
|
|
|
|
|
];
|
|
|
|
|
$filename = '元和员工参与企业明细';
|
|
|
|
|
break;
|
|
|
|
|
|