|
|
|
@ -125,7 +125,7 @@ class CompanyController extends BaseController
|
|
|
|
if ($start_year && $end_year) {
|
|
|
|
if ($start_year && $end_year) {
|
|
|
|
// 使用 LIKE 匹配 JSON 字符串中的年份范围
|
|
|
|
// 使用 LIKE 匹配 JSON 字符串中的年份范围
|
|
|
|
$query->where(function ($q) use ($start_year, $end_year) {
|
|
|
|
$query->where(function ($q) use ($start_year, $end_year) {
|
|
|
|
for ($year = (int) $start_year; $year <= (int) $end_year; $year++) {
|
|
|
|
for ($year = (int)$start_year; $year <= (int)$end_year; $year++) {
|
|
|
|
$q->orWhere('project_users', 'like', '%' . $year . '%');
|
|
|
|
$q->orWhere('project_users', 'like', '%' . $year . '%');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
@ -208,35 +208,16 @@ class CompanyController extends BaseController
|
|
|
|
'course_signs_invested' => 0,
|
|
|
|
'course_signs_invested' => 0,
|
|
|
|
'company_invested_after_enrollment_total' => 0,
|
|
|
|
'company_invested_after_enrollment_total' => 0,
|
|
|
|
'company_invested_year_total' => 0,
|
|
|
|
'company_invested_year_total' => 0,
|
|
|
|
'course_signs_invested_companies' => [],
|
|
|
|
|
|
|
|
'company_invested_after_enrollment_companies' => [],
|
|
|
|
|
|
|
|
'company_invested_year_companies' => [],
|
|
|
|
|
|
|
|
];
|
|
|
|
];
|
|
|
|
$start_date = $start_year ? $start_year . '-01-01' : date('Y-01-01');
|
|
|
|
$start_date = $start_year ? $start_year . '-01-01' : date('Y-01-01');
|
|
|
|
$end_date = $end_year ? $end_year . '-12-31' : date('Y-m-d');
|
|
|
|
$end_date = $end_year ? $end_year . '-12-31' : date('Y-m-d');
|
|
|
|
if ($start_date && $end_date) {
|
|
|
|
if ($start_date && $end_date) {
|
|
|
|
// 累计被投企业数(从起始日期到结束日期)
|
|
|
|
// 累计被投企业数(从起始日期到结束日期)
|
|
|
|
$investedCompanies = Company::yhInvestedTotal($end_date, true);
|
|
|
|
$statistics['course_signs_invested'] = Company::yhInvestedTotal($end_date);
|
|
|
|
if ($investedCompanies) {
|
|
|
|
|
|
|
|
$investedCompaniesCollection = collect($investedCompanies);
|
|
|
|
|
|
|
|
$statistics['course_signs_invested'] = $investedCompaniesCollection->count();
|
|
|
|
|
|
|
|
$statistics['course_signs_invested_companies'] = $investedCompaniesCollection->pluck('company_name')->filter()->unique()->values()->toArray();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 今年年份范围内被投企业数
|
|
|
|
// 今年年份范围内被投企业数
|
|
|
|
$yearInvestedCompanies = Company::companyInvestedYear($start_date, $end_date, true);
|
|
|
|
$statistics['company_invested_year_total'] = Company::companyInvestedYear($start_date, $end_date);
|
|
|
|
if ($yearInvestedCompanies) {
|
|
|
|
|
|
|
|
$yearInvestedCompaniesCollection = collect($yearInvestedCompanies);
|
|
|
|
|
|
|
|
$statistics['company_invested_year_total'] = $yearInvestedCompaniesCollection->count();
|
|
|
|
|
|
|
|
$statistics['company_invested_year_companies'] = $yearInvestedCompaniesCollection->pluck('company_name')->filter()->unique()->values()->toArray();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 入学后被投企业数量(在指定时间范围内报名的学员所在公司中,在入学后被投的公司数量)
|
|
|
|
// 入学后被投企业数量(在指定时间范围内报名的学员所在公司中,在入学后被投的公司数量)
|
|
|
|
$afterEnrollmentCompanies = CourseSign::companyInvestedAfterEnrollment($start_date, $end_date, null, true);
|
|
|
|
$statistics['company_invested_after_enrollment_total'] = CourseSign::companyInvestedAfterEnrollment($start_date, $end_date);
|
|
|
|
if ($afterEnrollmentCompanies) {
|
|
|
|
|
|
|
|
$statistics['company_invested_after_enrollment_total'] = count($afterEnrollmentCompanies);
|
|
|
|
|
|
|
|
$statistics['company_invested_after_enrollment_companies'] = collect($afterEnrollmentCompanies)->pluck('company.company_name')->filter()->unique()->values()->toArray();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 将统计数据添加到返回结果中
|
|
|
|
// 将统计数据添加到返回结果中
|
|
|
|
|