weaver-work-cli 0.1.49 → 0.1.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/chunks/{attachment-content-MU2LPI5P.js → attachment-content-MBYYSQIX.js} +3 -3
- package/dist/chunks/{chunk-ZKEUGS2U.js → chunk-7UOXOGFL.js} +4 -4
- package/dist/chunks/{chunk-72MI3MBX.js → chunk-ATEXBEPD.js} +55 -15
- package/dist/chunks/{chunk-3NV2ETZR.js → chunk-D3TDNRFE.js} +8 -8
- package/dist/chunks/{chunk-6GWU63YF.js → chunk-DZOC77ZD.js} +1 -1
- package/dist/chunks/{chunk-K3BT54CU.js → chunk-IRMA3GVP.js} +1 -1
- package/dist/chunks/{chunk-3X7VOSBA.js → chunk-KLZ3ULQQ.js} +1 -1
- package/dist/chunks/{chunk-YLCYX7LE.js → chunk-KMRT7NAT.js} +18 -5
- package/dist/chunks/{chunk-NBEWUR7L.js → chunk-LALWNK6M.js} +167 -44
- package/dist/chunks/{chunk-BRRW7CWA.js → chunk-LM2H7SZI.js} +26 -26
- package/dist/chunks/{chunk-KV5SOWMS.js → chunk-LTRLF6MM.js} +4 -4
- package/dist/chunks/{chunk-D2QRZUW4.js → chunk-RPRFIG6I.js} +35 -28
- package/dist/chunks/{chunk-GEOMANP7.js → chunk-RWFRZSIP.js} +2 -2
- package/dist/chunks/{chunk-EJVA5ZVB.js → chunk-ZRHKGQRQ.js} +2 -2
- package/dist/chunks/{conflict-6347A7YK.js → conflict-D2HYKBMH.js} +2 -2
- package/dist/chunks/{contract-N6P2HIIE.js → contract-MFOFMM2J.js} +4284 -254
- package/dist/chunks/{create-flow-7WG7LVX5.js → create-flow-7ZATJVTM.js} +6 -6
- package/dist/chunks/{data-QO7QWOIV.js → data-WK5CQXNF.js} +17 -32
- package/dist/chunks/{env-LHRKSLG6.js → env-5DO4YENS.js} +2 -2
- package/dist/chunks/{factory-2H7Z4RWJ.js → factory-3M7D7WJC.js} +1 -1
- package/dist/chunks/{fna-ZVB2IILI.js → fna-ECOYBQYL.js} +328 -5
- package/dist/chunks/{group-chat-EW6PNDDT.js → group-chat-B2HT5NEO.js} +3 -3
- package/dist/chunks/{im-3RCNL5GT.js → im-TN2JYVGJ.js} +2 -2
- package/dist/chunks/{invoice-FXWH5GPO.js → invoice-V7ZTITUO.js} +726 -206
- package/dist/chunks/{meeting-N2FQBHXI.js → meeting-HZOX3CBB.js} +10 -10
- package/dist/chunks/{msg-parse-4GSQ2WTO.js → msg-parse-FPFVPMYI.js} +5 -1
- package/dist/chunks/{reception-MYOKJULO.js → reception-QGPNTGHG.js} +98 -82
- package/dist/chunks/{recruit-stage-FKWS5UQF.js → recruit-stage-XCMVEQA2.js} +718 -131
- package/dist/chunks/{registry-BUTEDK3C.js → registry-E5RQJVWN.js} +2 -2
- package/dist/chunks/{registry-7VZ6YJUF.js → registry-KYPFFQIH.js} +1 -1
- package/dist/chunks/{registry-CKUVBS53.js → registry-SJHSBO5G.js} +10 -10
- package/dist/chunks/{room-recommend-MBCYENQ2.js → room-recommend-5AHR4YQV.js} +4 -4
- package/dist/chunks/{schedule-5IFMCXME.js → schedule-KZPJUPC2.js} +4 -4
- package/dist/chunks/smart-extract-IXHCZE4R.js +2846 -0
- package/dist/chunks/{workflow-2TRU2ZSP.js → workflow-UHKCZJMY.js} +1 -1
- package/dist/index.js +14 -9
- package/dist/shortcuts/contract/host.js +11 -0
- package/dist/shortcuts/contract/index.js +13 -0
- package/dist/shortcuts/contract/manifest.js +204 -0
- package/dist/shortcuts/contract/operations/card-action.js +585 -0
- package/dist/shortcuts/contract/operations/card-ebdf-list.js +315 -0
- package/dist/shortcuts/contract/operations/card-plan.js +327 -0
- package/dist/shortcuts/contract/operations/card-risk-report.js +565 -0
- package/dist/shortcuts/contract/operations/elements-build.js +714 -0
- package/dist/shortcuts/contract/operations/elements-spec.js +216 -0
- package/dist/shortcuts/contract/operations/first-screen.js +563 -0
- package/dist/shortcuts/contract/operations/flow.js +81 -25
- package/dist/shortcuts/contract/operations/modeltext.js +132 -0
- package/dist/shortcuts/contract/operations/op-resolver.js +22 -0
- package/dist/shortcuts/contract/operations/performance.js +58 -7
- package/dist/shortcuts/contract/operations/quote.js +410 -22
- package/dist/shortcuts/contract/operations/registry.js +22 -0
- package/dist/shortcuts/contract/operations/review.js +73 -58
- package/dist/shortcuts/contract/operations/save-recognize.js +151 -0
- package/dist/shortcuts/contract/operations/summary-validate.js +293 -0
- package/dist/shortcuts/contract/operations/summary.js +4 -2
- package/dist/shortcuts/contract/operations/upload.js +48 -7
- package/dist/shortcuts/contract/prewarm-cache.js +90 -0
- package/dist/shortcuts/contract/prewarm.js +88 -0
- package/dist/shortcuts/contract/upload-cache.js +49 -4
- package/dist/shortcuts/data/index.js +1 -6
- package/dist/shortcuts/data/manifest.js +2 -2
- package/dist/shortcuts/data/operations/index.js +1 -1
- package/dist/shortcuts/data/operations/query.js +23 -46
- package/dist/shortcuts/fna/host.js +4 -2
- package/dist/shortcuts/fna/manifest.js +14 -5
- package/dist/shortcuts/fna/operations/audit.js +334 -0
- package/dist/shortcuts/fna/operations/registry.js +2 -0
- package/dist/shortcuts/im/operations/at-mention.js +6 -3
- package/dist/shortcuts/im/operations/msg-parse.js +35 -5
- package/dist/shortcuts/im/operations/msg-sync.js +3 -1
- package/dist/shortcuts/im/operations/msg-write.js +57 -9
- package/dist/shortcuts/index.js +5 -0
- package/dist/shortcuts/invoice/index.js +0 -12
- package/dist/shortcuts/invoice/manifest.js +201 -50
- package/dist/shortcuts/invoice/operations/registry.js +4 -2
- package/dist/shortcuts/invoice/operations/reim-relation.js +438 -0
- package/dist/shortcuts/invoice/operations/shared.js +3 -19
- package/dist/shortcuts/invoice/operations/upload-and-validate.js +109 -73
- package/dist/shortcuts/meeting/operations/from-group-chat.js +16 -2
- package/dist/shortcuts/reception/constants.js +3 -7
- package/dist/shortcuts/reception/operations/leads.js +30 -6
- package/dist/shortcuts/reception/operations/panels.js +3 -2
- package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +4 -2
- package/dist/shortcuts/recruit-stage/operations/jd-create.js +6 -2
- package/dist/shortcuts/recruit-stage/operations/list.js +217 -1
- package/dist/shortcuts/recruit-stage/operations/resume-import.js +144 -158
- package/dist/shortcuts/recruit-stage/operations/search.js +348 -0
- package/dist/shortcuts/recruit-stage/shared.js +5 -0
- package/dist/shortcuts/recruit-stage/tag-lookup.js +136 -0
- package/dist/shortcuts/smart-extract/constants.js +79 -0
- package/dist/shortcuts/smart-extract/continuation.js +71 -0
- package/dist/shortcuts/smart-extract/errors.js +68 -0
- package/dist/shortcuts/smart-extract/host.js +191 -0
- package/dist/shortcuts/smart-extract/index.js +105 -0
- package/dist/shortcuts/smart-extract/ledger.js +70 -0
- package/dist/shortcuts/smart-extract/manifest.js +35 -0
- package/dist/shortcuts/smart-extract/operations/attachment.js +212 -0
- package/dist/shortcuts/smart-extract/operations/batch.js +67 -0
- package/dist/shortcuts/smart-extract/operations/config.js +118 -0
- package/dist/shortcuts/smart-extract/operations/fill.js +489 -0
- package/dist/shortcuts/smart-extract/operations/preview.js +174 -0
- package/dist/shortcuts/smart-extract/operations/registry.js +34 -0
- package/dist/shortcuts/smart-extract/operations/save.js +355 -0
- package/dist/shortcuts/smart-extract/operations/shared.js +191 -0
- package/dist/shortcuts/smart-extract/operations/structure.js +401 -0
- package/dist/shortcuts/smart-extract/operations/target.js +167 -0
- package/dist/shortcuts/smart-extract/operations/types.js +22 -0
- package/dist/shortcuts/smart-extract/operations/validate.js +408 -0
- package/dist/shortcuts/workflow/operations/read.js +77 -15
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +140 -24
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +42 -14
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +4 -6
- package/docs/SKILL.md +1 -1
- package/docs/_catalog.md +4 -1
- package/docs/agent-invoice.md +5 -7
- package/docs/data.md +5 -1
- package/docs/fna.md +24 -4
- package/docs/invoice.md +7 -5
- package/docs/smart-extract.md +156 -0
- package/package.json +1 -1
- package/skill-template/business-info.json +21 -1
- package/skill-template/domains/qiyecheng.md +6 -2
- package/skill-template/domains/smart-extract.md +16 -0
- package/skill-template/domains/yepiaotong.md +2 -2
- package/skills/weaver-e10-data/references/scene-and-misc.md +4 -3
- package/skills/weaver-e10-jinchengda/SKILL.md +159 -11
- package/skills/weaver-e10-jinchengda/references/contract-action-card.md +13 -8
- package/skills/weaver-e10-jinchengda/references/contract-action-engine.md +5 -4
- package/skills/weaver-e10-jinchengda/references/contract-clause-library-crud.md +44 -2
- package/skills/weaver-e10-jinchengda/references/contract-command-index.md +2 -2
- package/skills/weaver-e10-jinchengda/references/contract-element-save-record.md +220 -0
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-new-customer.md +68 -33
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +26 -15
- package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-modeltext-library.md +128 -0
- package/skills/weaver-e10-jinchengda/references/contract-multi-file.md +90 -0
- package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +96 -2
- package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +167 -5
- package/skills/weaver-e10-jinchengda/scripts/contract_first_screen.py +200 -0
- package/skills/weaver-e10-jinchengda/scripts/fill_contract_from_quote.py +572 -0
- package/skills/weaver-e10-jinchengda/scripts/fill_plan.py +997 -0
- package/skills/weaver-e10-jinchengda/scripts/quote_screen.py +560 -0
- package/skills/weaver-e10-jinchengda/scripts/triage_contract.py +894 -0
- package/skills/weaver-e10-jinchengda/scripts/validate_action_card.py +93 -0
- package/skills/weaver-e10-jinchengda/scripts/verify_docx_placeholders.py +118 -0
- package/skills/weaver-e10-qiyecheng/SKILL.md +58 -7
- package/skills/weaver-e10-qiyecheng/references/ai-check-audit.md +118 -0
- package/skills/weaver-e10-qiyecheng/references/budget.md +14 -0
- package/skills/weaver-e10-qiyecheng/references/catalog.md +42 -3
- package/skills/weaver-e10-qiyecheng/references/expense-center.md +8 -0
- package/skills/weaver-e10-qiyecheng/references/expense-chart.md +9 -0
- package/skills/weaver-e10-qiyecheng/references/invoice-writeoff.md +13 -0
- package/skills/weaver-e10-qiyecheng/references/loan-management.md +14 -0
- package/skills/weaver-e10-qiyecheng/references/self-hosted-mode.md +239 -0
- package/skills/weaver-e10-qiyecheng/references/source-manifest.json +153 -40
- package/skills/weaver-e10-reception-flow/SKILL.md +43 -6
- package/skills/weaver-e10-reception-flow/references/guide.md +1 -1
- package/skills/weaver-e10-recruit-stage/SKILL.md +62 -4
- package/skills/weaver-e10-recruit-stage/agents/openai.yaml +42 -8
- package/skills/weaver-e10-recruit-stage/references/env-ziyong.md +79 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +11 -3
- package/skills/weaver-e10-recruit-stage/references/recruit-edit-interview-feedback.md +3 -2
- package/skills/weaver-e10-recruit-stage/references/recruit-interview-not-attended.md +153 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +7 -4
- package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-my-positions.md +66 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +156 -40
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import-batch.md +122 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +36 -8
- package/skills/weaver-e10-recruit-stage/references/recruit-search-by-tag.md +157 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +35 -0
- package/skills/weaver-e10-smart-extract/SKILL.md +169 -0
- package/skills/weaver-e10-smart-extract/references/api-contract.md +71 -0
- package/skills/weaver-e10-smart-extract/references/result-format.md +102 -0
- package/skills/weaver-e10-smart-extract/references/troubleshooting.md +105 -0
- package/skills/weaver-e10-workflow/SKILL.md +2 -1
- package/skills/weaver-e10-workflow/references/todo-smart-convert.md +29 -6
- package/skills/weaver-e10-workflow/references/workflow-query.md +1 -1
- package/skills/weaver-e10-workflow/references/workflow-view.md +1 -1
- package/skills/weaver-e10-workflow/tools/todo-summary.cjs +162 -10
- package/skills/weaver-e10-yepiaotong/SKILL.md +53 -35
- package/skills/weaver-e10-yepiaotong/references/invoice-add.md +2 -0
- package/skills/weaver-e10-yepiaotong/references/invoice-file-upload.md +1 -1
- package/skills/weaver-e10-yepiaotong/references/invoice-import.md +19 -2
- package/skills/weaver-e10-yepiaotong/references/invoice-issuing-workflow.md +19 -32
- package/skills/weaver-e10-yepiaotong/references/invoice-ocr-preview.md +8 -2
- package/skills/weaver-e10-yepiaotong/references/invoice-reim-relation.md +407 -0
- package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +18 -53
- package/skills/weaver-e10-yepiaotong/references/invoice-upload-and-validate.md +97 -39
- package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +96 -7
- package/skills/weaver-e10-yepiaotong/references/reim-examples.md +5 -38
- package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +14 -14
- package/skills/weaver-e10-yepiaotong/references/reim-matching-rules.md +8 -4
- package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +139 -94
- package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +131 -58
- package/skills/weaver-e10-yepiaotong/references/source-manifest.json +110 -43
- package/skills/weaver-e10-yimiaoban/SKILL.md +8 -6
- package/skills/weaver-e10-yimiaoban/references/msg-read.md +20 -0
- package/skills/weaver-e10-yimiaoban/references/msg-write.md +7 -0
- package/skills/weaver-e10-yimiaoban/references/source-manifest.json +18 -15
- package/dist/shortcuts/invoice/operations/validate-preview.js +0 -40
- package/skills/weaver-e10-jinchengda/scripts/plan_actions.py +0 -279
- package/skills/weaver-e10-jinchengda/scripts/render_action_card.py +0 -450
- package/skills/weaver-e10-jinchengda/scripts/render_risk_report.py +0 -358
- package/skills/weaver-e10-yepiaotong/references/invoice-validation-preview.md +0 -40
|
@@ -23,6 +23,7 @@ import schoolTiers from '../school-tiers.json';
|
|
|
23
23
|
import { rsSuccess, schemaOf } from './types.js';
|
|
24
24
|
import { rsFail, rsValidationError, rsConfirmationError } from '../errors.js';
|
|
25
25
|
import { objIdOf, formIdOf, saveFormData, getFormLayoutMeta, runSaveButtonEsbActions, getTableMapping, invertTableMapping, datasetSaveFormData, datasetUpdateFormData, checkUnique, getCandidateByPhone, buildCardUrl, buildTalentViewUrl, talentLinkExtra, talentUiCardUrl, resolveTalentListUrl, findMenuNode, randHex32, getDsOptions, dsOptionsSnapshot, restoreDsOptions, invalidateEnvCache, verifySubmitted, expectedFields, probeCreatePermission, } from '../shared.js';
|
|
26
|
+
import { resolveTags, addEntityTags, queryEntityTags } from '../tag-lookup.js';
|
|
26
27
|
import { scanResumeSource, findStructuredJson } from '../fs-scan.js';
|
|
27
28
|
import { saveBatchItems, loadBatchItems } from '../batch-store.js';
|
|
28
29
|
// 更新时不允许简历覆盖的字段(人工判定/流程状态,简历无权改写)
|
|
@@ -72,6 +73,29 @@ async function uploadResume(host, baseUrl, filePath, fieldId, formId) {
|
|
|
72
73
|
throw rsFail('简历上传失败:' + JSON.stringify(j || {}).slice(0, 200));
|
|
73
74
|
return { fileid: String(j.data.fileid), name: j.data.name || filename };
|
|
74
75
|
}
|
|
76
|
+
// ── 可选头像:只在用户主动给图时写入;不自动提取、失败不阻断建档(2026-11-12 101 实测) ──
|
|
77
|
+
// 头像字段是 ImageComponent + 单值 VARCHAR(64):写入传 **fileid 字符串**,
|
|
78
|
+
// 服务端自动反解成 {fieldType:"ImageComponent", fieldOptionId, fieldOptionName}。
|
|
79
|
+
// 传 [{...}] 会报「单选字段不能选择多个」,传对象数组序列化会报「数据超长」。
|
|
80
|
+
async function writeAvatarIfProvided(ctx, opts) {
|
|
81
|
+
const raw = opts.photoFile ? String(opts.photoFile).trim() : '';
|
|
82
|
+
if (!raw)
|
|
83
|
+
return { written: false };
|
|
84
|
+
const avatarFieldId = (opts.fields || {}).avatar;
|
|
85
|
+
if (!avatarFieldId)
|
|
86
|
+
return { written: false, warning: '当前环境人才表单没有「头像」字段,已跳过头像' };
|
|
87
|
+
const abs = path.resolve(raw);
|
|
88
|
+
if (!fs.existsSync(abs))
|
|
89
|
+
return { written: false, warning: '头像图片不存在,已跳过:' + abs };
|
|
90
|
+
try {
|
|
91
|
+
const up = await uploadResume(ctx.host, opts.baseUrl, abs, avatarFieldId, opts.formId);
|
|
92
|
+
await datasetUpdateFormData(ctx.host, { objId: opts.objId, dataId: opts.dataId, mainTable: { avatar: up.fileid } });
|
|
93
|
+
return { written: true, fileId: up.fileid, name: up.name };
|
|
94
|
+
}
|
|
95
|
+
catch (e) {
|
|
96
|
+
return { written: false, warning: '头像写入失败(已跳过,不影响建档):' + (e?.message || e) };
|
|
97
|
+
}
|
|
98
|
+
}
|
|
75
99
|
// OCR 兜底解析(仅显式 useOcr 才调用):唯一闸门 = checkResumeExtraction
|
|
76
100
|
async function extractResume(host, fileid) {
|
|
77
101
|
const b = await host.request({ path: '/api/recruit/ocr/checkResumeExtraction', method: 'POST', body: {} });
|
|
@@ -420,153 +444,9 @@ async function matchTalentLabel(host, talentId) {
|
|
|
420
444
|
const r = await host.request({ path: '/api/recruit/label/matchTalentLabel?talentId=' + encodeURIComponent(talentId), method: 'POST', body: {} });
|
|
421
445
|
return r?.data || null;
|
|
422
446
|
}
|
|
423
|
-
// b)
|
|
424
|
-
//
|
|
425
|
-
//
|
|
426
|
-
// total 判定」需 20+ 次串行请求 ≈ 20s,是简历链路最大瓶颈(不带标签 7.77s → 带标签 28.09s)。
|
|
427
|
-
// 标签属低频变更数据 → 磁盘缓存(24h)+ 并发翻页(限 5)后:首次 ~1-2s、后续 0 请求。
|
|
428
|
-
// ── 平台标签解析:按名精确查询优先,服务端未过滤时回退全量并发(不落盘)──
|
|
429
|
-
// 背景(2026-11-04 实测 www.e-cology.com.cn):平台标签 1924 个、绝大部分与招聘无关;
|
|
430
|
-
// 原「全量分页 + 磁盘缓存」在网页版小E 沙箱(容器不持久、盘可能只读)无收益,且缓存无用户维度
|
|
431
|
-
// (个人标签存在跨用户读取风险)。现改为:按名逐个并发查询(N 个标签 → 1 轮请求),
|
|
432
|
-
// 仅当确认服务端未按名过滤时才回退「全量并发翻页」,**不做磁盘缓存**。
|
|
433
|
-
/** 单名查询:并行 type0/type1;filtered=false 表示该 type 返回满页且 total 很大(疑似未按名过滤) */
|
|
434
|
-
async function queryTagByName(host, name) {
|
|
435
|
-
const pageSize = 100;
|
|
436
|
-
const bodyOf = (type) => ({ type, name, order: 8, pageSize, pageNo: 1, search: 1, tagGroup: 0, tagModules: ['ebuilderform'] });
|
|
437
|
-
const rs = await Promise.all([0, 1].map((type) => host.request({ path: '/api/my/tag/query', method: 'POST', body: bodyOf(type) }).catch(() => null)));
|
|
438
|
-
const items = [];
|
|
439
|
-
let filtered = true;
|
|
440
|
-
for (const r of rs) {
|
|
441
|
-
const d = r?.data || {};
|
|
442
|
-
const list = Array.isArray(d.data) ? d.data : [];
|
|
443
|
-
const total = Number(d.total || 0);
|
|
444
|
-
if (list.length >= pageSize && total >= pageSize)
|
|
445
|
-
filtered = false;
|
|
446
|
-
items.push(...list);
|
|
447
|
-
}
|
|
448
|
-
return { items, filtered };
|
|
449
|
-
}
|
|
450
|
-
// 单个 type 的全量标签:第 1 页拿 total → 剩余页按批并发(每批 5,上限 40 页防失控)
|
|
451
|
-
async function fetchTagsOfType(host, type) {
|
|
452
|
-
const pageSize = 100;
|
|
453
|
-
const bodyOf = (pageNo) => ({ type, name: '', order: 8, pageSize, pageNo, search: 1, tagGroup: 0, tagModules: ['ebuilderform'] });
|
|
454
|
-
const first = await host.request({ path: '/api/my/tag/query', method: 'POST', body: bodyOf(1) }).catch(() => null);
|
|
455
|
-
const d = first?.data || {};
|
|
456
|
-
const rows = Array.isArray(d.data) ? [...d.data] : [];
|
|
457
|
-
const total = Number(d.total || 0);
|
|
458
|
-
const pages = Math.min(40, Math.max(1, Math.ceil(total / pageSize)));
|
|
459
|
-
if (pages > 1 && rows.length) {
|
|
460
|
-
const rest = Array.from({ length: pages - 1 }, (_, i) => i + 2);
|
|
461
|
-
for (let i = 0; i < rest.length; i += 5) {
|
|
462
|
-
const batch = rest.slice(i, i + 5);
|
|
463
|
-
const rs = await Promise.all(batch.map((p) => host.request({ path: '/api/my/tag/query', method: 'POST', body: bodyOf(p) }).catch(() => null)));
|
|
464
|
-
for (const r of rs) {
|
|
465
|
-
const list = r?.data?.data;
|
|
466
|
-
if (Array.isArray(list))
|
|
467
|
-
rows.push(...list);
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
return rows;
|
|
472
|
-
}
|
|
473
|
-
async function listPlatformTags(host) {
|
|
474
|
-
const all = [];
|
|
475
|
-
for (const type of [0, 1]) {
|
|
476
|
-
try {
|
|
477
|
-
all.push(...await fetchTagsOfType(host, type));
|
|
478
|
-
}
|
|
479
|
-
catch { /* 单类型失败不影响另一类 */ }
|
|
480
|
-
}
|
|
481
|
-
const seen = new Set();
|
|
482
|
-
return all.filter((t) => t && t.tagId && !seen.has(String(t.tagId)) && seen.add(String(t.tagId)));
|
|
483
|
-
}
|
|
484
|
-
// 按名解析 → tagId(不存在进 missing,不臆造;同名优先公共标签)
|
|
485
|
-
// 默认场景(简历导入)names 通常只有 1~4 个学校标签 → 1 轮并发按名查询即可;用户显式要求时才扩到其他标签。
|
|
486
|
-
async function resolveTags(host, names) {
|
|
487
|
-
const norm = (s) => String(s == null ? '' : s).trim().toLowerCase();
|
|
488
|
-
const byName = new Map();
|
|
489
|
-
const uniqNames = [...new Set((names || []).map((n) => String(n)).filter(Boolean))];
|
|
490
|
-
let availableCount;
|
|
491
|
-
if (!uniqNames.length)
|
|
492
|
-
return { resolved: [], found: [], missing: [], available: [], availableCount };
|
|
493
|
-
// ① 按名并发查询(N 个名字 → 1 轮)
|
|
494
|
-
const probes = await Promise.all(uniqNames.map((n) => queryTagByName(host, n).catch(() => ({ items: [], filtered: true }))));
|
|
495
|
-
const nameQueryUsable = probes.every((p) => p.filtered);
|
|
496
|
-
if (nameQueryUsable) {
|
|
497
|
-
for (const p of probes) {
|
|
498
|
-
for (const t of p.items) {
|
|
499
|
-
if (!t || !t.tagId)
|
|
500
|
-
continue;
|
|
501
|
-
const k = norm(t.name);
|
|
502
|
-
const prev = byName.get(k);
|
|
503
|
-
if (!prev)
|
|
504
|
-
byName.set(k, t);
|
|
505
|
-
else if ((prev.type ?? 0) !== 0 && t.type === 0)
|
|
506
|
-
byName.set(k, t);
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
else {
|
|
511
|
-
// ② 回退:服务端疑似未按名过滤 → 全量并发(不落盘)
|
|
512
|
-
const dict = await listPlatformTags(host);
|
|
513
|
-
availableCount = dict.length;
|
|
514
|
-
for (const t of dict) {
|
|
515
|
-
const k = norm(t.name);
|
|
516
|
-
const prev = byName.get(k);
|
|
517
|
-
if (!prev)
|
|
518
|
-
byName.set(k, t);
|
|
519
|
-
else if ((prev.type ?? 0) !== 0 && t.type === 0)
|
|
520
|
-
byName.set(k, t);
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
const resolved = [];
|
|
524
|
-
const found = [];
|
|
525
|
-
const missing = [];
|
|
526
|
-
for (const n of names || []) {
|
|
527
|
-
const t = byName.get(norm(n));
|
|
528
|
-
if (!t) {
|
|
529
|
-
missing.push(n);
|
|
530
|
-
continue;
|
|
531
|
-
}
|
|
532
|
-
resolved.push({ id: String(t.tagId), name: t.name, type: t.type ?? 0 });
|
|
533
|
-
found.push(t.name);
|
|
534
|
-
}
|
|
535
|
-
return {
|
|
536
|
-
resolved, found, missing, availableCount,
|
|
537
|
-
available: [...byName.values()].map((t) => ({ tagId: String(t.tagId), name: t.name, type: t.type ?? 0 })),
|
|
538
|
-
};
|
|
539
|
-
}
|
|
540
|
-
// c) 写入实体标签(先确认存在再写;不存在不写)
|
|
541
|
-
async function addEntityTags(host, talentId, names) {
|
|
542
|
-
if (!names || !names.length)
|
|
543
|
-
return { applied: [], skipped: [] };
|
|
544
|
-
const { resolved, found, missing } = await resolveTags(host, names);
|
|
545
|
-
if (!resolved.length)
|
|
546
|
-
return { applied: [], skipped: missing };
|
|
547
|
-
const r = await host.request({
|
|
548
|
-
path: '/api/my/tag/common/batchAddEntityTag', method: 'POST',
|
|
549
|
-
body: { tags: resolved, batchDatas: [{ entityId: String(talentId), module: 'ebuilderform' }] },
|
|
550
|
-
});
|
|
551
|
-
if (r?.status === false)
|
|
552
|
-
return { applied: [], skipped: [...missing, ...found], error: r?.msg };
|
|
553
|
-
return { applied: found, skipped: missing };
|
|
554
|
-
}
|
|
555
|
-
// d) 读回某人才当前标签(data[].content = 标签名)
|
|
556
|
-
async function queryEntityTags(host, talentId) {
|
|
557
|
-
const out = [];
|
|
558
|
-
for (const type of [0, 1]) {
|
|
559
|
-
try {
|
|
560
|
-
const r = await host.request({ path: '/api/my/tag/common/queryEntityTag', method: 'POST', body: { entityId: String(talentId), module: 'ebuilderform', type } });
|
|
561
|
-
const list = r?.data;
|
|
562
|
-
if (Array.isArray(list))
|
|
563
|
-
for (const t of list)
|
|
564
|
-
out.push(t.content || t.name || t.labelName || String(t.id || ''));
|
|
565
|
-
}
|
|
566
|
-
catch { /* 读标签失败不影响主流程 */ }
|
|
567
|
-
}
|
|
568
|
-
return [...new Set(out.filter(Boolean))];
|
|
569
|
-
}
|
|
447
|
+
// b) 平台标签(按名解析 / 写入 / 读回)已抽到 ../tag-lookup.js,
|
|
448
|
+
// 由「简历建档打标签」与「按标签搜人才」共用,避免两份实现漂移。
|
|
449
|
+
// 标签 id 各环境不同,一律运行时按名解析,绝不写死。
|
|
570
450
|
// ── 学校归属标签推导(985/211/双一流):内置全国名单(school-tiers.json 随包分发)──
|
|
571
451
|
// 由解析出的毕业院校直接推导候选,再走「环境标签清单按名求交」落库(清单里没有的自动 skip)。
|
|
572
452
|
function deriveSchoolTags(structured) {
|
|
@@ -873,9 +753,24 @@ async function buildImport(ctx, args) {
|
|
|
873
753
|
// 学校归属标签推导(并入标签候选)
|
|
874
754
|
const schoolTagInfo = args.noSchoolTags ? { candidates: [], detail: [], schools: [] } : deriveSchoolTags(structured);
|
|
875
755
|
const tagNames = [...(args.tags || [])];
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
756
|
+
// 🔴 2026-11-11 修「裸校名被当标签试写」:candidates 原先无条件全量塞入 tagNames,
|
|
757
|
+
// 即使该校 tiers 为空(推导已判定不属 985/211/双一流)也会去 resolveTags 试一次;
|
|
758
|
+
// 环境无此标签 → 进 missing → tagsSkipped 出现噪音(实测:「西北工业大学明德学院」
|
|
759
|
+
// tiers:[] 却出现在 tagsSkipped,易被误读成「环境缺标签」),且白跑一次标签清单解析。
|
|
760
|
+
// 现在:层级标签(985/211/双一流等,不在 schools 里)一律保留;裸校名只有确实推导出
|
|
761
|
+
// 层级时才作为标签尝试,tiers 为空则跳过。
|
|
762
|
+
const schoolNameSet = new Set(((schoolTagInfo.schools) || []).map((s) => String(s)));
|
|
763
|
+
const tieredSchoolSet = new Set(((schoolTagInfo.detail) || [])
|
|
764
|
+
.filter((d) => Array.isArray(d && d.tiers) && d.tiers.length > 0)
|
|
765
|
+
.map((d) => String((d && d.school) || '')));
|
|
766
|
+
for (const t of schoolTagInfo.candidates) {
|
|
767
|
+
if (tagNames.includes(t))
|
|
768
|
+
continue;
|
|
769
|
+
const nm = String(t);
|
|
770
|
+
if (schoolNameSet.has(nm) && !tieredSchoolSet.has(nm))
|
|
771
|
+
continue;
|
|
772
|
+
tagNames.push(nm);
|
|
773
|
+
}
|
|
879
774
|
// 字段映射 + 附件
|
|
880
775
|
const dataDetails = mapToTalent(fields, structured);
|
|
881
776
|
if (fileid) {
|
|
@@ -1015,6 +910,7 @@ const baseInput = {
|
|
|
1015
910
|
structuredFile: { type: 'string', description: '结构化简历 JSON 文件路径(兼容脚本版用法)' },
|
|
1016
911
|
fileId: { type: 'string', description: '已上传到 E10 的简历附件 id(原件写进附件字段)' },
|
|
1017
912
|
resumeFile: { type: 'string', description: '本地简历文件路径(两步 multipart 上传)' },
|
|
913
|
+
photoFile: { type: 'string', description: '可选:用户主动提供的头像图片本地路径。不自动从简历提取;没给或写失败都跳过,不影响建档' },
|
|
1018
914
|
channel: { type: 'string', description: '简历渠道(须在数据字典中存在;缺省固定「手动录入」)' },
|
|
1019
915
|
tags: { type: 'array', items: { type: 'string' }, maxItems: 20, description: '平台标签名(按名命中环境清单,不存在跳过;学校归属自动推导另算)' },
|
|
1020
916
|
useOcr: { type: 'boolean', description: '显式开启 OCR 兜底解析(闸门=checkResumeExtraction;默认永不上调)' },
|
|
@@ -1100,6 +996,7 @@ async function prepare(args, env, opts = {}) {
|
|
|
1100
996
|
structuredFile: args.structuredFile ? String(args.structuredFile) : undefined,
|
|
1101
997
|
fileId: args.fileId ? String(args.fileId) : undefined,
|
|
1102
998
|
resumeFile: args.resumeFile ? String(args.resumeFile) : undefined,
|
|
999
|
+
photoFile: args.photoFile ? String(args.photoFile) : undefined,
|
|
1103
1000
|
channel: args.channel ? String(args.channel) : undefined,
|
|
1104
1001
|
updateTalentId: args.updateTalentId ? String(args.updateTalentId) : undefined,
|
|
1105
1002
|
useOcr: args.useOcr === true,
|
|
@@ -1176,6 +1073,12 @@ async function prepare(args, env, opts = {}) {
|
|
|
1176
1073
|
formConflicts: dupInfo.formConflicts.existing,
|
|
1177
1074
|
unreadableIds: dupInfo.formConflicts.unreadable,
|
|
1178
1075
|
byPhoneError: dupInfo.byPhoneError,
|
|
1076
|
+
// 🔴 2026-11-11 新增:区分「真重复」与「上次建档已成功后的复跑」。
|
|
1077
|
+
// 实测:apply 成功后再跑一次 prepare(不带 updateTalentId)会 unique:false 命中刚建的自己,
|
|
1078
|
+
// 而文档口径是「已存在同手机号人才 → 提示并停住,不重复建档」→ 重试路径被自己的查重挡死。
|
|
1079
|
+
// 这里不改判定逻辑(查重该拦就拦),只补一个明确出口,避免 Agent 笼统报「已存在」后卡住。
|
|
1080
|
+
retryHint: dupInfo.unique ? undefined
|
|
1081
|
+
: '若本次是重试/复跑(上次 apply 可能已成功),请改用 updateTalentId=<命中的人才id> 走更新通道,不要重复建档',
|
|
1179
1082
|
note: dupInfo.byPhone
|
|
1180
1083
|
? '手机号已绑定人才(页面同款 getCandidateByPhone 命中)→ 不新建,给出人才查看页地址'
|
|
1181
1084
|
: (dupInfo.formConflicts.existing.length
|
|
@@ -1205,7 +1108,17 @@ async function prepare(args, env, opts = {}) {
|
|
|
1205
1108
|
tags: args.tags,
|
|
1206
1109
|
} });
|
|
1207
1110
|
return rsSuccess('recruit-stage.resume.import.prepare', {
|
|
1208
|
-
mode: 'prepare',
|
|
1111
|
+
mode: 'prepare',
|
|
1112
|
+
// 🔴 2026-11-11 修「截断丢 token」:prepare 输出 12 KB+,continuation 原落在 data 尾部,
|
|
1113
|
+
// Agent 按行数截断读取(如 Select-Object -First N)就会丢 token → apply 报
|
|
1114
|
+
// continuation_required → 被迫重跑 prepare → 连带重复上传原件、在附件库留孤儿文件
|
|
1115
|
+
// (实测一轮留下 2 个附件 id、只有 1 个被绑定)。前置到 mode 之后,截断也能拿到;
|
|
1116
|
+
// meta.continuation 原样保留,向后兼容。
|
|
1117
|
+
continuation,
|
|
1118
|
+
...summary,
|
|
1119
|
+
photo: args.photoFile
|
|
1120
|
+
? { file: path.basename(String(args.photoFile)), exists: fs.existsSync(path.resolve(String(args.photoFile))) }
|
|
1121
|
+
: null,
|
|
1209
1122
|
willSubmit,
|
|
1210
1123
|
tagCheck,
|
|
1211
1124
|
schoolTags: built.schoolTagInfo,
|
|
@@ -1213,6 +1126,7 @@ async function prepare(args, env, opts = {}) {
|
|
|
1213
1126
|
// 🔴 2026-11-07:本 op 此前无 preview(与 jd.create 同类缺陷)。新建场景要把「建档字段 + 标签预检结果」一起给出来。
|
|
1214
1127
|
preview: {
|
|
1215
1128
|
...summary,
|
|
1129
|
+
photo: args.photoFile ? { file: path.basename(String(args.photoFile)) } : null,
|
|
1216
1130
|
tagCheck,
|
|
1217
1131
|
schoolTags: built.schoolTagInfo,
|
|
1218
1132
|
onCommit: '提交后将:建人才 → 初始化批次 → 自动标签匹配 → 写平台标签 → 输出卡片与人才库链接',
|
|
@@ -1251,6 +1165,11 @@ async function applyCore(args, env, payload) {
|
|
|
1251
1165
|
objId: built.objId, dataId: updateTalentId, mainTable: upMain,
|
|
1252
1166
|
details: built.detailsPayload, coverDetails: Object.keys(built.detailsPayload),
|
|
1253
1167
|
});
|
|
1168
|
+
// 可选头像:用户主动给图才写;失败只记在 avatar.warning,不并入 verifyWarnings(不改变 result)
|
|
1169
|
+
const avatarRes = await writeAvatarIfProvided(ctx, {
|
|
1170
|
+
photoFile: argsT.photoFile, dataId: updateTalentId, fields: built.fields,
|
|
1171
|
+
objId: built.objId, formId: built.formId, baseUrl: ctx.baseUrl,
|
|
1172
|
+
});
|
|
1254
1173
|
// 自检:行数与格数都要对得上;落库有短暂延迟,首读不符等 600ms 重读一次再判定
|
|
1255
1174
|
const checkAfter = (snap) => {
|
|
1256
1175
|
const out = [];
|
|
@@ -1279,6 +1198,9 @@ async function applyCore(args, env, payload) {
|
|
|
1279
1198
|
talentId: updateTalentId,
|
|
1280
1199
|
afterSummary: { mainFieldCount: Object.keys(after.main).length, subRows: after.subRows, subCells: after.subCells },
|
|
1281
1200
|
verifyWarnings: verifyWarnings.length ? verifyWarnings : undefined,
|
|
1201
|
+
avatar: avatarRes.written
|
|
1202
|
+
? { written: true, fileId: avatarRes.fileId, name: avatarRes.name }
|
|
1203
|
+
: { written: false, warning: avatarRes.warning },
|
|
1282
1204
|
talentCardUrl: await resolveTalentCardUrl(ctx, updateTalentId),
|
|
1283
1205
|
talentListLocateUrl: await resolveTalentListLocateUrl(ctx, updateTalentId),
|
|
1284
1206
|
parsed: { name: built.structured.candidateName, mobile: built.structured.telephone, email: built.structured.email || '(空)' },
|
|
@@ -1336,6 +1258,11 @@ async function applyCore(args, env, payload) {
|
|
|
1336
1258
|
}
|
|
1337
1259
|
const r2 = await host.request({ path: '/api/recruit/candidate/initTalentBatch?formDataId=' + newId, method: 'POST' });
|
|
1338
1260
|
const talentId = String(newId);
|
|
1261
|
+
// 可选头像:只在用户主动给图时写;失败不阻断,也不改变 result 判定
|
|
1262
|
+
const avatarRes = await writeAvatarIfProvided(ctx, {
|
|
1263
|
+
photoFile: argsT.photoFile, dataId: newId, fields: built.fields,
|
|
1264
|
+
objId: built.objId, formId: built.formId, baseUrl: ctx.baseUrl,
|
|
1265
|
+
});
|
|
1339
1266
|
// 写后 4 件事并行(都只依赖 talentId、彼此无依赖):
|
|
1340
1267
|
// ① verifySubRows 回读明细校验(读)
|
|
1341
1268
|
// ② runSaveButtonEsbActions 执行「保存」按钮 esb 动作流(写副作用:建日程/通知等)
|
|
@@ -1373,15 +1300,48 @@ async function applyCore(args, env, payload) {
|
|
|
1373
1300
|
// 标签回读依赖写入结果,放在并行组之后(写操作可验证优先)
|
|
1374
1301
|
const tags = await queryEntityTags(host, talentId).catch(() => []);
|
|
1375
1302
|
// 第三层门禁:主表关键字段落库回查(明细行由 verifySubRows 单独校验)
|
|
1303
|
+
// 🔴 回查白名单动态化(2026-11-11 修「age 假绿」):原白名单硬编码 3 个字段,
|
|
1304
|
+
// 提交体带了 age 但未落库时,verification 仍报 checked:3 / mismatches:[] / result:success。
|
|
1305
|
+
// 现在:核心 3 字段严格比对值;本次提交的其余主表字段按「非空」比对(避免联动/动作链改写造成假红);
|
|
1306
|
+
// 并把实际校验清单明示到 checkedFields —— mismatches:[] 不再等于「全字段通过」。
|
|
1307
|
+
const CORE_VERIFY_KEYS = ['candidate_name', 'telephone', 'email'];
|
|
1308
|
+
const submittedKeys = Object.keys(built.fields).filter((k) => built.dataDetails.some((d) => String(d?.formField?.id) === String(built.fields[k])));
|
|
1309
|
+
const strictKeys = CORE_VERIFY_KEYS.filter((k) => submittedKeys.includes(k));
|
|
1310
|
+
const nonEmptyKeys = submittedKeys.filter((k) => !strictKeys.includes(k));
|
|
1311
|
+
const expectedList = [
|
|
1312
|
+
...expectedFields(built.dataDetails, built.fields, strictKeys, [], ['email']),
|
|
1313
|
+
...expectedFields(built.dataDetails, built.fields, nonEmptyKeys, nonEmptyKeys, []),
|
|
1314
|
+
];
|
|
1376
1315
|
const verification = await verifySubmitted({
|
|
1377
1316
|
host, formId: built.formId, objId: built.objId, dataId: newId,
|
|
1378
|
-
expected:
|
|
1317
|
+
expected: expectedList,
|
|
1379
1318
|
});
|
|
1380
1319
|
if (verification.mismatches.length) {
|
|
1381
1320
|
invalidateEnvCache(ctx.baseUrl, ctx.appId);
|
|
1382
1321
|
for (const m of verification.mismatches)
|
|
1383
1322
|
writeWarnings.push('落库回查不一致:' + m.label + ' 期望 ' + m.expected + ',实际 ' + m.actual);
|
|
1384
1323
|
}
|
|
1324
|
+
// 🔴 2026-11-11 新增:附件绑定自证。用户诉求「上传附件到人才库」此前无法从回执判定
|
|
1325
|
+
// (apply 输出 24 个字段里没有任何附件字段),只能人肉点页面确认。
|
|
1326
|
+
// 复用上面 verifySubmitted 的回查结果(零额外 HTTP):original_resume 已被动态白名单
|
|
1327
|
+
// 纳入 nonEmptyOnly 比对,这里只把它的结论单独提取出来明示,并在绑不上时点名。
|
|
1328
|
+
const attachFieldChecked = expectedList.some((e) => e.label === 'original_resume');
|
|
1329
|
+
const attachMismatch = verification.mismatches.find((m) => m.label === 'original_resume');
|
|
1330
|
+
const attachmentVerify = {
|
|
1331
|
+
field: 'original_resume',
|
|
1332
|
+
fileId: built.fileid || null,
|
|
1333
|
+
// checked=false 表示环境缓存无该字段定义、未进回查清单,不代表绑定失败
|
|
1334
|
+
checked: attachFieldChecked,
|
|
1335
|
+
bound: attachFieldChecked ? !attachMismatch : null,
|
|
1336
|
+
detail: attachMismatch
|
|
1337
|
+
? '附件字段回查不一致:期望非空,实际 ' + attachMismatch.actual
|
|
1338
|
+
: (built.fileid
|
|
1339
|
+
? (attachFieldChecked ? '附件字段已回查确认非空' : '原件已上传(fileId 见上),但环境缓存无 original_resume 字段定义,未纳入回查')
|
|
1340
|
+
: '本次未上传原件(文本直建 / 纯 structured 输入)'),
|
|
1341
|
+
};
|
|
1342
|
+
if (attachMismatch) {
|
|
1343
|
+
writeWarnings.push('简历附件未绑定到人才记录(original_resume 回查为空):原件已上传但未写入附件字段,请在人才卡片页手工补挂,或走 updateTalentId 重传');
|
|
1344
|
+
}
|
|
1385
1345
|
const result = detailsState === 'complete' && !verification.mismatches.length ? 'success' : 'partial';
|
|
1386
1346
|
const talentCardUrl = await resolveTalentCardUrl(ctx, talentId);
|
|
1387
1347
|
const talentListLocateUrl = await resolveTalentListLocateUrl(ctx, talentId);
|
|
@@ -1391,8 +1351,18 @@ async function applyCore(args, env, payload) {
|
|
|
1391
1351
|
newCandidateFormDataId: newId,
|
|
1392
1352
|
talentId,
|
|
1393
1353
|
writeChannel,
|
|
1394
|
-
|
|
1354
|
+
attachmentVerify,
|
|
1355
|
+
verification: {
|
|
1356
|
+
checked: verification.checked,
|
|
1357
|
+
// 明示本次实际校验了哪些字段:checked 数字 + 空 mismatches 不再能被误读为「全字段通过」
|
|
1358
|
+
checkedFields: expectedList.map((e) => e.label),
|
|
1359
|
+
mismatches: verification.mismatches,
|
|
1360
|
+
unavailable: verification.unavailable || null,
|
|
1361
|
+
},
|
|
1395
1362
|
writeWarnings: writeWarnings.length ? writeWarnings : undefined,
|
|
1363
|
+
avatar: avatarRes.written
|
|
1364
|
+
? { written: true, fileId: avatarRes.fileId, name: avatarRes.name }
|
|
1365
|
+
: { written: false, warning: avatarRes.warning },
|
|
1396
1366
|
subTablesExpected: built.subBuild.stats,
|
|
1397
1367
|
subTableVerify,
|
|
1398
1368
|
initTalentBatch: r2?.data?.msg || '',
|
|
@@ -1438,6 +1408,7 @@ async function batchPrepare(args, env) {
|
|
|
1438
1408
|
return {
|
|
1439
1409
|
file, name: file ? path.basename(file) : `第${i + 1}项`,
|
|
1440
1410
|
structured: x?.structured, structuredFile: x?.structuredFile,
|
|
1411
|
+
photoFile: x?.photoFile ? path.resolve(String(x.photoFile)) : undefined,
|
|
1441
1412
|
};
|
|
1442
1413
|
}
|
|
1443
1414
|
return { file: x.path, name: x.name, structured: undefined, structuredFile: undefined };
|
|
@@ -1484,7 +1455,7 @@ async function batchPrepare(args, env) {
|
|
|
1484
1455
|
}
|
|
1485
1456
|
row.status = 'ready';
|
|
1486
1457
|
items.push(row);
|
|
1487
|
-
ready.push({ index: i + 1, label: row.name || e.name, file: e.file, args: { ...shared, resumeFile: e.file || undefined, structured, structuredFile: structuredFile || undefined }, fingerprint: String(meta.fingerprint || '') });
|
|
1458
|
+
ready.push({ index: i + 1, label: row.name || e.name, file: e.file, args: { ...shared, resumeFile: e.file || undefined, photoFile: e.photoFile, structured, structuredFile: structuredFile || undefined }, fingerprint: String(meta.fingerprint || '') });
|
|
1488
1459
|
}
|
|
1489
1460
|
catch (err) {
|
|
1490
1461
|
row.status = 'failed';
|
|
@@ -1522,6 +1493,9 @@ async function batchPrepare(args, env) {
|
|
|
1522
1493
|
enumMaps: await dsOptionsSnapshot(),
|
|
1523
1494
|
batchFile: store.file,
|
|
1524
1495
|
batchFingerprint: store.fingerprint,
|
|
1496
|
+
// 准备阶段已被查重拦截的份数:apply 汇总里要如实报「跳过」,不能只报成功/失败
|
|
1497
|
+
blockedAtPrepare: items.filter((x) => x.status === 'blocked').length,
|
|
1498
|
+
needsParseAtPrepare: items.filter((x) => x.status === 'needs_parse').length,
|
|
1525
1499
|
});
|
|
1526
1500
|
return rsSuccess('recruit-stage.resume.import.batch.prepare', {
|
|
1527
1501
|
mode: 'batch-prepare',
|
|
@@ -1565,10 +1539,14 @@ async function batchApply(args, env) {
|
|
|
1565
1539
|
try {
|
|
1566
1540
|
const r = await applyCore({ ...(it.args || {}), confirm: true }, env, { fingerprint: it.fingerprint, enumMaps: batch.enumMaps });
|
|
1567
1541
|
const d = r.data || {};
|
|
1542
|
+
// 2026-11-12:prepare 到 apply 之间可能有人被建(或并发),applyCore 会返回 duplicate。
|
|
1543
|
+
// 重复人才**不新建**,状态必须记 skipped,不能混进 success 谎报「已建档」。
|
|
1544
|
+
const isDup = d.result === 'duplicate';
|
|
1568
1545
|
results.push({
|
|
1569
1546
|
index: it.index, file: path.basename(String(it.file || '')), name: it.label,
|
|
1570
|
-
status: d.result === 'partial' ? 'partial' : 'success',
|
|
1547
|
+
status: isDup ? 'skipped' : (d.result === 'partial' ? 'partial' : 'success'),
|
|
1571
1548
|
talentId: d.talentId, cardUrl: d.talentCardUrl, viewLink: d.viewLink,
|
|
1549
|
+
message: isDup ? (d.message || '手机号已存在,已跳过(未写入)') : undefined,
|
|
1572
1550
|
warnings: d.verifyWarnings && d.verifyWarnings.length ? d.verifyWarnings : undefined,
|
|
1573
1551
|
});
|
|
1574
1552
|
}
|
|
@@ -1579,18 +1557,26 @@ async function batchApply(args, env) {
|
|
|
1579
1557
|
const ok = results.filter((x) => x.status === 'success').length;
|
|
1580
1558
|
const partial = results.filter((x) => x.status === 'partial').length;
|
|
1581
1559
|
const failed = results.filter((x) => x.status === 'failed').length;
|
|
1560
|
+
const skipped = results.filter((x) => x.status === 'skipped').length;
|
|
1561
|
+
const blockedAtPrepare = Number(batch.blockedAtPrepare || 0);
|
|
1562
|
+
const label = (st) => (st === 'success' ? '成功' : st === 'partial' ? '部分成功' : st === 'skipped' ? '跳过(重复)' : '失败');
|
|
1582
1563
|
const lines = [
|
|
1583
1564
|
'| # | 文件 | 姓名 | 结果 | 说明 |',
|
|
1584
1565
|
'|---|---|---|---|---|',
|
|
1585
|
-
...results.map((x) => `| ${x.index} | ${x.file} | ${x.name || '-'} | ${x.status
|
|
1566
|
+
...results.map((x) => `| ${x.index} | ${x.file} | ${x.name || '-'} | ${label(x.status)} | ${x.message || (x.warnings?.length ? x.warnings.join(';') : x.cardUrl ? '已建档' : '')} |`),
|
|
1586
1567
|
];
|
|
1587
1568
|
return rsSuccess('recruit-stage.resume.import.batch.apply', {
|
|
1588
1569
|
mode: 'batch-apply',
|
|
1589
1570
|
result: failed || partial ? 'partial' : 'success',
|
|
1590
|
-
total: results.length,
|
|
1571
|
+
total: results.length,
|
|
1572
|
+
succeeded: ok, partial, failed, skipped,
|
|
1573
|
+
skippedAtPrepare: blockedAtPrepare,
|
|
1574
|
+
skippedTotal: blockedAtPrepare + skipped,
|
|
1591
1575
|
items: results,
|
|
1592
1576
|
resultTable: lines.join('\n'),
|
|
1593
|
-
agentNote: '把 resultTable
|
|
1577
|
+
agentNote: '把 resultTable 原样放回答正文。汇总必须说全四类:成功 / 部分成功 / 跳过(重复,不新建)/ 失败;'
|
|
1578
|
+
+ '跳过数 = skippedAtPrepare(准备阶段查重)+ skipped(建档时发现重复);'
|
|
1579
|
+
+ '失败或部分成功要带 message 原因,不要只报总数。末尾附「人才库」固定地址一个链接。',
|
|
1594
1580
|
});
|
|
1595
1581
|
}
|
|
1596
1582
|
export const resumeImportOperations = [
|