Files
autoAiWorkSys/api/model/job_postings.js
张成 df0aacc782 11
2026-04-16 14:01:52 +08:00

281 lines
6.4 KiB
JavaScript
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.
const Sequelize = require('sequelize');
/**
* 岗位信息表模型
* 存储从招聘平台获取的岗位信息及AI分析结果
*/
module.exports = (db) => {
const job_postings = db.define("job_postings", {
sn_code: {
comment: '设备SN码',
type: Sequelize.STRING(50),
allowNull: true,
defaultValue: ''
},
// 岗位基础信息
encryptBossId: {
comment: 'Boss加密ID',
type: Sequelize.STRING(100),
allowNull: true,
defaultValue: ''
},
securityId: {
comment: '安全ID',
type: Sequelize.STRING(255),
allowNull: true,
defaultValue: ''
},
jobId: {
comment: '岗位ID',
type: Sequelize.STRING(100),
allowNull: false,
defaultValue: ''
},
jobTitle: {
comment: '岗位名称',
type: Sequelize.STRING(200),
allowNull: false,
defaultValue: ''
},
companyId: {
comment: '公司ID',
type: Sequelize.STRING(100),
allowNull: true,
defaultValue: ''
},
companyName: {
comment: '公司名称',
type: Sequelize.STRING(200),
allowNull: false,
defaultValue: ''
},
companySize: {
comment: '公司规模',
type: Sequelize.STRING(50),
allowNull: true,
defaultValue: ''
},
companyIndustry: {
comment: '公司行业',
type: Sequelize.STRING(100),
allowNull: true,
defaultValue: ''
},
salary: {
comment: '薪资范围',
type: Sequelize.STRING(50),
allowNull: true,
defaultValue: ''
},
jobRequirements: {
comment: '岗位要求',
type: Sequelize.TEXT,
allowNull: true,
defaultValue: ''
},
jobDescription: {
comment: '岗位描述',
type: Sequelize.TEXT,
allowNull: true,
defaultValue: ''
},
location: {
comment: '工作地点',
type: Sequelize.STRING(100),
allowNull: true,
defaultValue: ''
},
// 经度
longitude: {
comment: '经度',
type: Sequelize.STRING(50),
allowNull: true,
defaultValue: ''
},
// 纬度
latitude: {
comment: '纬度',
type: Sequelize.STRING(50),
allowNull: true,
defaultValue: ''
},
experience: {
comment: '工作经验要求',
type: Sequelize.STRING(50),
allowNull: true,
defaultValue: ''
},
education: {
comment: '学历要求',
type: Sequelize.STRING(50),
allowNull: true,
defaultValue: ''
},
// AI分析结果
aiMatchScore: {
comment: 'AI匹配度评分',
type: Sequelize.INTEGER,
allowNull: true,
defaultValue: 0
},
aiSkillMatch: {
comment: 'AI技能匹配度',
type: Sequelize.INTEGER,
allowNull: true,
defaultValue: 0
},
aiExperienceMatch: {
comment: 'AI经验匹配度',
type: Sequelize.INTEGER,
allowNull: true,
defaultValue: 0
},
aiSalaryReasonable: {
comment: 'AI薪资合理性评分',
type: Sequelize.INTEGER,
allowNull: true,
defaultValue: 0
},
aiCompanyQuality: {
comment: 'AI公司质量评分',
type: Sequelize.INTEGER,
allowNull: true,
defaultValue: 0
},
isOutsourcing: {
comment: '是否外包岗位',
type: Sequelize.BOOLEAN,
allowNull: true,
defaultValue: false
},
aiAnalysis: {
comment: 'AI详细分析结果(JSON)',
type: Sequelize.TEXT,
allowNull: true,
defaultValue: ''
},
// 文本匹配分析结果
textMatchScore: {
comment: '文本匹配综合评分',
type: Sequelize.INTEGER,
allowNull: true,
defaultValue: 0
},
matchSuggestion: {
comment: '投递建议',
type: Sequelize.STRING(200),
allowNull: true,
defaultValue: ''
},
matchConcerns: {
comment: '关注点(JSON数组)',
type: Sequelize.TEXT,
allowNull: true,
defaultValue: '[]'
},
textMatchAnalysis: {
comment: '文本匹配详细分析结果(JSON)',
type: Sequelize.TEXT,
allowNull: true,
defaultValue: ''
},
outsourcingAnalysis: {
comment: '外包识别分析结果',
type: Sequelize.TEXT,
allowNull: true,
defaultValue: ''
},
// 投递状态
applyStatus: {
comment: '投递状态: pending-待投递, filtered-已过滤(不符合规则未投递), applied-已投递, rejected-被拒绝, accepted-已接受, success/failed-见业务',
type: Sequelize.STRING(20),
allowNull: true,
defaultValue: 'pending'
},
applyTime: {
comment: '投递时间',
type: Sequelize.DATE,
allowNull: true
},
is_delivered: {
comment: '是否已投递成功true 是false 否(含未投、失败、过滤)',
type: Sequelize.BOOLEAN,
allowNull: false,
defaultValue: false
},
deliver_failed_reason: {
comment: '未投递或投递失败原因(直接落库,不依赖连表)',
type: Sequelize.TEXT,
allowNull: true,
defaultValue: ''
},
chatStatus: {
comment: '聊天状态: none-未聊天, sent-已发送, replied-已回复',
type: Sequelize.STRING(20),
allowNull: true,
defaultValue: 'none'
},
chatTime: {
comment: '聊天时间',
type: Sequelize.DATE,
allowNull: true
},
// 关联信息
platform: {
comment: '平台: boss-Boss直聘, liepin-猎聘',
type: Sequelize.STRING(20),
allowNull: false,
defaultValue: 'boss'
},
keyword: {
comment: '搜索关键词',
type: Sequelize.STRING(50),
allowNull: true,
defaultValue: ''
},
// 其他信息
originalData: {
comment: '原始数据(JSON)',
type: Sequelize.TEXT,
allowNull: true,
defaultValue: ''
}
}, {
timestamps: true,
createdAt: 'create_time',
updatedAt: 'last_modify_time',
indexes: [
{
unique: false,
fields: ['jobId']
},
{
unique: false,
fields: ['encryptBossId']
},
{
unique: false,
fields: ['sn_code']
},
{
unique: false,
fields: ['applyStatus']
},
{
unique: false,
fields: ['aiMatchScore']
}
]
});
// job_postings.sync({ force: true });
return job_postings
};