master
cody 5 months ago
parent 4231f8918d
commit 416b1e47cd

@ -172,8 +172,10 @@ class CompanyController extends BaseController
* @OA\Parameter(name="valuation", in="query", @OA\Schema(type="integer", format="int64", nullable=true), description="估值"),
* @OA\Parameter(name="company_address", in="query", @OA\Schema(type="string", nullable=true), description="公司地址"),
* @OA\Parameter(name="company_area", in="query", @OA\Schema(type="string", nullable=true), description="公司区域"),
* @OA\Parameter(name="company_type", in="query", @OA\Schema(type="string", nullable=true), description="公司性质-上市,拟上市"),
* @OA\Parameter(name="company_city", in="query", @OA\Schema(type="string", nullable=true), description="公司城市"),
* @OA\Parameter(name="company_market", in="query", @OA\Schema(type="string", nullable=true), description="是否上市0否1是"),
* @OA\Parameter(name="company_industry", in="query", @OA\Schema(type="string", nullable=true), description="公司所属行业"),
* @OA\Parameter(name="is_schoolmate", in="query", @OA\Schema(type="string", nullable=true), description="是否校友企业-0非校友1校友"),
* @OA\Parameter(name="company_need_fund", in="query", @OA\Schema(type="string", nullable=true), description="公司是否需要融资-0否1是"),
* @OA\Parameter(name="company_introduce", in="query", @OA\Schema(type="string", format="textarea", nullable=true), description="公司简介"),
* @OA\Parameter(name="company_other", in="query", @OA\Schema(type="string", nullable=true), description="其他"),

@ -7,13 +7,16 @@ use App\Models\Admin;
use App\Models\Appointment;
use App\Models\AppointmentConfig;
use App\Models\CarparkLog;
use App\Models\Company;
use App\Models\CourseSign;
use App\Models\CourseType;
use App\Models\CustomFormField;
use App\Models\Department;
use App\Models\ParameterDetail;
use App\Models\User;
use App\Repositories\DoorRepository;
use App\Repositories\EntranceRepository;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Validator;
use App\Models\Course;
use EasyWeChat\Factory;
@ -38,9 +41,30 @@ class OtherController extends CommonController
public function home()
{
// 校友总数
$schoolmateTotal = User::where('is_schoolmate', 1)->count();
$schoolmate['schoolmate_total'] = User::where('is_schoolmate', 1)->count();
// 2025年校友数
$schoolmateTotalYear = User::where('is_schoolmate', 1)->where('created_at', 'like', '%' . date('Y') . '%')->count();
$schoolmate['schoolmate_year'] = User::where('is_schoolmate', 1)->where('created_at', 'like', '%' . date('Y') . '%')->count();
// 上市企业总市值
$company['company_market'] = Company::where('company_market', 1)->sum('market_value');
// 校友企业总融资额
$company['company_fund'] = Company::where('is_schoolmate', 1)->sum('company_fund');
// 校友企业总估值
$company['valuation'] = Company::where('is_schoolmate', 1)->sum('valuation');
// 校友企业所属领域
$industryTotal = [];
$industries = ParameterDetail::where('parameter_id', 4)->get();
foreach ($industries as $item) {
$level2Names = ParameterDetail::where('parameter_id', 10)->where('remark', $item->value)->pluck('value');
$industryTotal[] = [
'industry' => $item->value,
'total' => User::whereIn('company_industry', $level2Names)->count()
];
}
// 追加其他领域
$industryTotal[] = [
'industry' => '其他',
'total' => User::count() - collect($industryTotal)->sum('total')
];
// 课程统计
$courseTypes = CourseType::with('courses')->where('is_chart')->get();
foreach ($courseTypes as $courseType) {
@ -48,7 +72,17 @@ class OtherController extends CommonController
->where('status', 1)
->count();
}
return $this->success(compact('courseTypes', 'schoolmateTotal', 'schoolmateTotalYear'));
// 苏州区域数据
$suzhou = Company::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'))
->groupBy('company_city')
->get();
return $this->success(compact('courseTypes', 'schoolmate', 'company', 'industryTotal', 'suzhou', 'country'));
}
/**

@ -32,16 +32,19 @@ return new class extends Migration {
$table->string('management_platform')->nullable()->comment('管理平台');
// 项目经理
$table->string('project_manager')->nullable()->comment('项目经理');
$table->bigInteger('market_value')->nullable()->comment('市值');
$table->bigInteger('company_fund')->nullable()->comment('公司融资情况');
$table->bigInteger('valuation')->nullable()->comment('估值');
$table->string('company_address')->nullable()->comment('公司地址');
$table->string('company_area')->nullable()->comment('公司区域');
$table->string('company_city')->nullable()->comment('公司城市');
// 是否上市
$table->boolean('company_market')->nullable()->comment('公司性质-0未上市1已上市');
// 是否校友企业
$table->boolean('is_schoolmate')->nullable()->comment('是否校友企业-0非校友1校友');
$table->boolean('company_need_fund')->nullable()->comment('公司是否需要融资-0否1是');
$table->string('company_type')->nullable()->comment('公司性质-上市,拟上市');
$table->string('company_industry')->nullable()->comment('公司所属行业');
$table->string('company_need_fund')->nullable()->comment('公司是否需要融资-0否1是');
$table->text('company_introduce')->nullable()->comment('公司简介');
$table->string('company_other')->nullable()->comment('其他');
$table->text('company_product')->nullable()->comment('产品');

Loading…
Cancel
Save