master
lion 5 days ago
commit a14c37854c

@ -236,7 +236,10 @@ class UpdateCompany extends Command
$updatedCount = 0;
foreach ($companies as $company) {
$hasStockCode = preg_match($stockCodePattern, $company->company_tag);
$newMarketStatus = $hasStockCode ? 1 : 0;
// 检查是否包含"新三板"
$hasXinsanban = strpos($company->company_tag, '新三板') !== false;
// 如果匹配到股票代码或包含"新三板",则标记为上市
$newMarketStatus = ($hasStockCode || $hasXinsanban) ? 1 : 0;
// 只有状态变化才更新
if ($company->company_market != $newMarketStatus) {

@ -140,6 +140,12 @@ class OtherController extends CommonController
$list['cover_rencai_total'] = CourseSign::rencai();
// 重点上市公司
$list['cover_stock_total'] = CourseSign::shangshi();
// 培养人次
$list['course_signs_pass'] = CourseSign::courseSignsTotal(null, null, 1);
// 培养人数
$list['course_signs_pass_unique'] = CourseSign::courseSignsTotalByUnique(null, null, 1, null, null);
// 跟班学员数
$list['genban_total'] = CourseSign::genban();
// 本月课程
$monthCourses = Calendar::with('course.teacher')
->where('start_time', 'like', '%' . date('Y-m') . '%')
@ -159,11 +165,11 @@ class OtherController extends CommonController
$query->where('name', 'like', '%' . $courseType->name . '%');
})->get();
// 课程
$courses = Course::where('type', $courseType->id)->get();
$courses = Course::where('type', $courseType->id)->where('is_chart', 1)->get();
// 历史课程期数
$courseType->history_course_periods_total = $historyCourse->count();
// 现在课程数据
$courseType->now_course_periods_total = Course::where('type', $courseType->id)->count();
$courseType->now_course_periods_total = Course::where('type', $courseType->id)->where('is_chart', 1)->count();
// 历史课程培养人数去重
$courseType->history_course_signs_total = $historyCourse->sum('course_type_signs_pass_unique');
@ -301,7 +307,7 @@ class OtherController extends CommonController
$query->whereBetween('start_date', [$start_date, $end_date])
->orWhereBetween('end_date', [$start_date, $end_date]);
}
})->orderBy('start_date', 'asc')->get();
})->where('is_chart', 1)->orderBy('start_date', 'asc')->get();
foreach ($courses2 as $course) {
$courseTypesSum[] = [
'course_type' => $courseType->name,
@ -461,8 +467,9 @@ class OtherController extends CommonController
$data[] = [
'user_name' => $sign->user->name ?? '',
'mobile' => $sign->user->mobile ?? '',
'company_name' => $sign->user->company_name ?? '',
'company_area' => $sign->user->company_area ?? '',
'company_name' => $sign->user->company->company_name ?? '',
'company_area' => $sign->user->company->company_area ?? '',
'company_industry' => $sign->user->company->company_industry ?? '',
'course_name' => $sign->course->name ?? '',
'course_type' => $sign->course->typeDetail->name ?? '',
// 'created_at' => $sign->created_at ? $sign->created_at->format('Y-m-d H:i:s') : '',
@ -503,9 +510,9 @@ class OtherController extends CommonController
$data[] = [
'user_name' => $user->name ?? '',
'mobile' => $user->mobile ?? '',
'company_name' => $user->company_name ?? '',
'company_area' => $user->company_area ?? '',
'company_industry' => $user->company_industry ?? '',
'company_name' => $user->company->company_name ?? '',
'company_area' => $user->company->company_area ?? '',
'company_industry' => $user->company->company_industry ?? '',
'course_names' => $courseNames,
'course_count' => $userCourseSigns->count(),
];

@ -87,10 +87,13 @@ class CourseSign extends SoftDeletesModel
$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->whereBetween('start_date', [$start_date, $end_date])
->orWhereBetween('end_date', [$start_date, $end_date]);
$query->where(function ($query) use ($start_date, $end_date) {
$query->whereBetween('start_date', [$start_date, $end_date])
->orWhereBetween('end_date', [$start_date, $end_date]);
});
}
})->whereNotIn('status', [4, 5, 6]);
return $baseQuery;
@ -296,15 +299,15 @@ class CourseSign extends SoftDeletesModel
$years = [];
if ($start_date && $end_date) {
// 从开始和结束日期中提取年份范围
$startYear = (int) date('Y', strtotime($start_date));
$endYear = (int) date('Y', strtotime($end_date));
$startYear = (int)date('Y', strtotime($start_date));
$endYear = (int)date('Y', strtotime($end_date));
// 生成所有年份的数组
for ($year = $startYear; $year <= $endYear; $year++) {
$years[] = $year;
}
} else {
// 如果没有提供日期,使用当前年份
$years[] = (int) date('Y');
$years[] = (int)date('Y');
}
// 获取这些公司中标记为被投的公司
@ -320,7 +323,7 @@ class CourseSign extends SoftDeletesModel
foreach ($projectUsers as $item) {
$investDate = $item['investDate'] ?? null;
if ($investDate) {
$investYear = (int) date('Y', strtotime($investDate));
$investYear = (int)date('Y', strtotime($investDate));
if (in_array($investYear, $years)) {
$hasInvestInYears = true;
break;
@ -398,7 +401,7 @@ class CourseSign extends SoftDeletesModel
* @param bool $retList 是否返回列表false返回数量true返回列表
* @return int|\Illuminate\Database\Eloquent\Collection
*/
public static function genban($start_date, $end_date, $course_ids = null, $retList = false)
public static function genban($start_date = null, $end_date = null, $course_ids = null, $retList = false)
{
$courseSignsQuery = self::getStudentList($start_date, $end_date, 1, $course_ids);
// 获取需要统计跟班学员的课程

Loading…
Cancel
Save