Files
work_dhd_back_end/test_match_real.php

199 lines
7.5 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// 使用简历-岗位.md中的真实数据测试
require __DIR__ . '/vendor/autoload.php';
// 岗位信息(从简历-岗位.md
$position = [
"id" => 1,
"base_info" => [
"岗位名称" => "人工智能与大数据侦察职位一",
"招考单位" => "市级公安机关",
"招录人数" => "10",
"岗位代码" => "45150001"
],
"position_info" => [
"岗位名称" => "人工智能与大数据侦察职位一",
"招考单位" => "市级公安机关",
"招录人数" => "10",
"岗位代码" => "45150001",
"备注" => "考生按照总成绩由高到低的顺序依次在对应的职位计划表中选择具体工作岗位。",
"招录机关" => "自治区公安厅",
"职位序号" => "1",
"职位简介" => "从事公安机关人工智能研发、大数据系统建设管理、数据信息挖掘及分析研判等专业技术工作。"
],
"position_require" => [
"学历要求" => "本科及以上",
"学位要求" => "学士及以上",
"年龄要求" => "18周岁以上、35周岁以下。",
"回避要求" => "报考人员不得报考与市公安局领导班子成员、内设机构领导班子成员(如刑侦支队支队长、副支队长等)存在规定回避情形的职位(回避情形含夫妻关系、直系血亲关系、三代以内旁系血亲关系以及近姻亲关系)。",
"专业资格条件" => "曾参加人工智能、大数据、计算机领域竞赛,获个人三等奖或团体三等奖及以上,提供官方证明文件。",
"其他资格条件" => "适合男性。符合人民警察录用条件。单侧矫正视力低于5.0不合格。",
"专业(学科)类别" => "计算机科学与技术类,电气、电子及自动化类"
]
];
// 简历信息(从简历-岗位.md
$resume = [
"user_id" => 527,
"exam_city" => [
[
"name" => "贵州省",
"child" => [
[
"name" => "贵阳市",
"city_id" => 604132
],
[
"name" => "六盘水市",
"city_id" => 605834
],
[
"name" => "遵义市",
"city_id" => 607029
]
],
"city_id" => 604131
]
],
"exam_type_id" => [3, 8],
"birth_date" => "1989-03-01",
"gender" => "",
"ethnicity" => "汉族",
"city_id" => 609311,
"origin_city_id" => 609311,
"political_status" => "群众",
"special_identity" => "无特殊身份/其他特特身份",
"is_young" => "",
"grassroots_program" => "",
"work_experience" => "无基层工作年限",
"exam_type_name" => ["事业单位", "公务员"],
"city_name" => "贵州,安顺,西秀",
"origin_city_name" => "贵州,安顺,西秀",
"education" => [
[
"id" => 1,
"user_id" => 527,
"education_level" => "普通本科",
"degree" => "学士",
"majors_id" => 1016,
"education_type" => "全日制",
"graduate_date" => "2012-07-01",
"majors_name" => "逻辑学"
],
[
"id" => 2,
"user_id" => 527,
"education_level" => "硕士研究生",
"degree" => "硕士",
"majors_id" => 513,
"education_type" => "全日制",
"graduate_date" => "2015-07-01",
"majors_name" => "伦理学"
]
]
];
// 加载ThinkPHP框架
$app = new think\App();
$app->initialize();
// 创建匹配服务实例
$matchService = new app\service\MatchService();
// 计算匹配度
$result = $matchService->calculateMatchScore($position, $resume);
// 输出结果
echo "========================================\n";
echo "岗位简历匹配度测试(真实数据)\n";
echo "========================================\n\n";
echo "【岗位信息】\n";
echo "----------------------------------------\n";
echo "岗位名称: " . $position['base_info']['岗位名称'] . "\n";
echo "招考单位: " . $position['base_info']['招考单位'] . "\n";
echo "学历要求: " . $position['position_require']['学历要求'] . "\n";
echo "学位要求: " . $position['position_require']['学位要求'] . "\n";
echo "年龄要求: " . $position['position_require']['年龄要求'] . "\n";
echo "专业要求: " . $position['position_require']['专业(学科)类别'] . "\n";
echo "其他条件: " . $position['position_require']['其他资格条件'] . "\n\n";
echo "【简历信息】\n";
echo "----------------------------------------\n";
$highestEdu = null;
$highestLevel = 0;
$educationLevels = ['普通本科' => 3, '硕士研究生' => 4, '博士研究生' => 5];
foreach ($resume['education'] as $edu) {
$level = $educationLevels[$edu['education_level']] ?? 0;
if ($level > $highestLevel) {
$highestLevel = $level;
$highestEdu = $edu;
}
}
echo "最高学历: " . ($highestEdu['education_level'] ?? '未知') . "\n";
echo "最高学位: " . ($highestEdu['degree'] ?? '未知') . "\n";
echo "专业: ";
foreach ($resume['education'] as $edu) {
echo $edu['majors_name'] . " ";
}
echo "\n";
$age = date('Y') - date('Y', strtotime($resume['birth_date']));
if (date('md') < date('md', strtotime($resume['birth_date']))) {
$age--;
}
echo "年龄: {$age}岁 (出生日期: {$resume['birth_date']})\n";
echo "性别: " . $resume['gender'] . "\n";
echo "基层工作经历: " . $resume['work_experience'] . "\n\n";
echo "【硬性条件检查结果】\n";
echo "----------------------------------------\n";
if ($result['qualified']) {
echo "✓ 通过硬性条件筛选\n\n";
foreach ($result['hard_requirements']['details'] as $key => $detail) {
if (isset($detail['passed'])) {
$status = $detail['passed'] ? '✓' : '✗';
echo "{$status} {$key}: ";
if ($detail['passed']) {
echo "通过 (要求: {$detail['required']}, 实际: {$detail['actual']})\n";
} else {
echo "不通过 - {$detail['reason']}\n";
}
}
}
} else {
echo "✗ 未通过硬性条件筛选\n\n";
echo "不通过原因:\n";
foreach ($result['rejection_reasons'] as $reason) {
echo " - {$reason}\n";
}
echo "\n详细检查结果:\n";
foreach ($result['hard_requirements']['details'] as $key => $detail) {
if (isset($detail['passed'])) {
$status = $detail['passed'] ? '✓' : '✗';
echo "{$status} {$key}: ";
if ($detail['passed']) {
echo "通过 (要求: {$detail['required']}, 实际: {$detail['actual']})\n";
} else {
echo "不通过 - {$detail['reason']}\n";
}
}
}
}
echo "\n【软性条件评分结果】\n";
echo "----------------------------------------\n";
if ($result['qualified']) {
echo "总分: {$result['score']}/{$result['soft_requirements']['max_score']}\n\n";
foreach ($result['soft_requirements']['details'] as $key => $detail) {
echo "{$key}: {$detail['score']}/{$detail['max_score']}分 - {$detail['reason']}\n";
}
} else {
echo "(未通过硬性条件筛选,不进行软性条件评分)\n";
}
echo "\n========================================\n";
echo "最终结果: " . ($result['qualified'] ? "✓ 符合条件,匹配度 {$result['score']}/100分" : "✗ 不符合条件") . "\n";
echo "========================================\n";