|
|
|
|
@ -72,9 +72,9 @@ class OtherController extends CommonController
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 校友企业总融资额
|
|
|
|
|
$company['company_fund'] = Company::where('is_schoolmate', 1)->sum('company_fund');
|
|
|
|
|
$company['company_fund'] = Company::approvedStudents()->where('is_schoolmate', 1)->sum('company_fund');
|
|
|
|
|
// 校友企业总估值
|
|
|
|
|
$company['valuation'] = Company::where('is_schoolmate', 1)->sum('valuation');
|
|
|
|
|
$company['valuation'] = Company::approvedStudents()->where('is_schoolmate', 1)->sum('valuation');
|
|
|
|
|
|
|
|
|
|
// 校友企业所属领域
|
|
|
|
|
$industryTotal = [];
|
|
|
|
|
@ -95,13 +95,13 @@ class OtherController extends CommonController
|
|
|
|
|
->count();
|
|
|
|
|
}
|
|
|
|
|
// 苏州区域数据
|
|
|
|
|
$suzhou = Company::where('company_city', '苏州市')
|
|
|
|
|
$suzhou = Company::approvedStudents()->where('company_city', '苏州市')
|
|
|
|
|
// 根据company_area分组查询公司数量
|
|
|
|
|
->select('company_area', DB::raw('count(*) as company_total'))
|
|
|
|
|
->groupBy('company_area')
|
|
|
|
|
->get();
|
|
|
|
|
// 全国数据
|
|
|
|
|
$country = Company::select('company_city', DB::raw('count(*) as company_total'))
|
|
|
|
|
$country = Company::approvedStudents()->select('company_city', DB::raw('count(*) as company_total'))
|
|
|
|
|
->groupBy('company_city')
|
|
|
|
|
->get();
|
|
|
|
|
return $this->success(compact('courseTypes', 'schoolmate', 'company', 'industryTotal', 'suzhou', 'country'));
|
|
|
|
|
@ -190,7 +190,7 @@ class OtherController extends CommonController
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 苏州区域数据
|
|
|
|
|
$suzhouArea = Company::where('company_city', '苏州市')->groupBy('company_area')
|
|
|
|
|
$suzhouArea = Company::approvedStudents()->where('company_city', '苏州市')->groupBy('company_area')
|
|
|
|
|
->whereNotNull('company_area')
|
|
|
|
|
->get(['company_area']);
|
|
|
|
|
$suzhou = [];
|
|
|
|
|
@ -204,7 +204,7 @@ class OtherController extends CommonController
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 全国数据
|
|
|
|
|
$countryArea = Company::groupBy('company_city')->whereNotNull('company_city')->get(['company_city']);
|
|
|
|
|
$countryArea = Company::approvedStudents()->groupBy('company_city')->whereNotNull('company_city')->get(['company_city']);
|
|
|
|
|
$country = [];
|
|
|
|
|
foreach ($countryArea as $item) {
|
|
|
|
|
$total = User::whereHas('company', function ($query) use ($item) {
|
|
|
|
|
@ -494,31 +494,69 @@ class OtherController extends CommonController
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'course_signs_pass_unique':
|
|
|
|
|
// 审核通过人数去重明细 - 使用courseSignsTotalByUnique方法获取列表
|
|
|
|
|
// 审核通过人数去重明细 - 使用courseSignsTotalByUnique方法获取列表(与coursesHome保持一致)
|
|
|
|
|
$users = CourseSign::courseSignsTotalByUnique($start_date, $end_date, 1, $course_ids, true);
|
|
|
|
|
// 预加载 company 关系,避免 N+1 查询问题
|
|
|
|
|
$users->load('company');
|
|
|
|
|
foreach ($users as $user) {
|
|
|
|
|
// 获取该学员报名的课程列表(与coursesHome逻辑保持一致)
|
|
|
|
|
$userCourseSigns = CourseSign::where('user_id', $user->id)
|
|
|
|
|
// 获取该学员报名的课程列表 - 使用与getStudentList完全一致的逻辑
|
|
|
|
|
$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查询
|
|
|
|
|
$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);
|
|
|
|
|
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])
|
|
|
|
|
->with('course')
|
|
|
|
|
})
|
|
|
|
|
->whereNotIn('status', [4, 5, 6])
|
|
|
|
|
->where('user_id', $user->id)
|
|
|
|
|
->with(['course.typeDetail'])
|
|
|
|
|
->get();
|
|
|
|
|
$courseNames = $userCourseSigns->pluck('course.name')->filter()->unique()->implode("\n\r");
|
|
|
|
|
|
|
|
|
|
// 获取课程名称列表,用中文顿号分隔
|
|
|
|
|
$courseNames = $userCourseSigns->pluck('course.name')->filter()->unique()->values()->implode('、');
|
|
|
|
|
|
|
|
|
|
// 获取课程体系列表,用中文顿号分隔
|
|
|
|
|
$courseTypes = $userCourseSigns->pluck('course.typeDetail.name')
|
|
|
|
|
->filter()
|
|
|
|
|
->unique()
|
|
|
|
|
->values()
|
|
|
|
|
->implode('、');
|
|
|
|
|
|
|
|
|
|
// 企查查企业(来自 company 表)
|
|
|
|
|
$qccCompanyName = $user->company && $user->company->company_name
|
|
|
|
|
? $user->company->company_name
|
|
|
|
|
: '';
|
|
|
|
|
// 用户填写企业(来自 user 表)
|
|
|
|
|
$userCompanyName = $user->company_name ?? '';
|
|
|
|
|
|
|
|
|
|
// 优先使用 company 关系的企业信息,如果不存在则使用 User 表的字段
|
|
|
|
|
$companyArea = $user->company && $user->company->company_area
|
|
|
|
|
? $user->company->company_area
|
|
|
|
|
: ($user->company_area ?? '');
|
|
|
|
|
$companyIndustry = $user->company && $user->company->company_industry
|
|
|
|
|
? $user->company->company_industry
|
|
|
|
|
: ($user->company_industry ?? '');
|
|
|
|
|
|
|
|
|
|
$data[] = [
|
|
|
|
|
'user_name' => $user->name ?? '',
|
|
|
|
|
'mobile' => $user->mobile ?? '',
|
|
|
|
|
'company_name' => $user->company->company_name ?? '',
|
|
|
|
|
'company_area' => $user->company->company_area ?? '',
|
|
|
|
|
'company_industry' => $user->company->company_industry ?? '',
|
|
|
|
|
'qcc_company_name' => $qccCompanyName,
|
|
|
|
|
'user_company_name' => $userCompanyName,
|
|
|
|
|
'company_position' => $user->company_position ?? '',
|
|
|
|
|
'company_area' => $companyArea,
|
|
|
|
|
'company_industry' => $companyIndustry,
|
|
|
|
|
'course_types' => $courseTypes,
|
|
|
|
|
'course_names' => $courseNames,
|
|
|
|
|
'course_count' => $userCourseSigns->count(),
|
|
|
|
|
];
|
|
|
|
|
@ -526,9 +564,12 @@ class OtherController extends CommonController
|
|
|
|
|
$fields = [
|
|
|
|
|
'user_name' => '学员姓名',
|
|
|
|
|
'mobile' => '手机号',
|
|
|
|
|
'company_name' => '企业名称',
|
|
|
|
|
'qcc_company_name' => '企查查企业',
|
|
|
|
|
'user_company_name' => '用户填写企业',
|
|
|
|
|
'company_position' => '职务',
|
|
|
|
|
'company_area' => '所在区域',
|
|
|
|
|
'company_industry' => '所属行业',
|
|
|
|
|
'course_types' => '课程体系',
|
|
|
|
|
'course_names' => '报名课程',
|
|
|
|
|
'course_count' => '报名课程数',
|
|
|
|
|
];
|
|
|
|
|
|