weaver-work-cli 0.1.62 → 0.1.63
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/dist/chunks/{archive-S2VKZWQ3.js → archive-BLDYBZDX.js} +5 -4
- package/dist/chunks/{archive-oa-HEDSIUUY.js → archive-oa-3GJ3TWXR.js} +5 -4
- package/dist/chunks/{asset-HYH4W357.js → asset-AFXJN4CK.js} +5 -4
- package/dist/chunks/{asset-idle-N7REBNGL.js → asset-idle-VUJXWGWJ.js} +5 -4
- package/dist/chunks/{attachment-content-VYYA75FR.js → attachment-content-VMJA7NSQ.js} +3 -3
- package/dist/chunks/{blog-SLMZZICV.js → blog-EREB35VU.js} +5 -4
- package/dist/chunks/{caizhilian-RV43KKBT.js → caizhilian-ATM2JO5S.js} +5 -5
- package/dist/chunks/{calendar-DMVZ4OLY.js → calendar-E26ZIH7S.js} +5 -4
- package/dist/chunks/{chunk-6XSSAUNW.js → chunk-4OB22YKE.js} +48 -12
- package/dist/chunks/{chunk-UBGWIXU3.js → chunk-5CY37VLS.js} +131 -38
- package/dist/chunks/{chunk-EGANE35F.js → chunk-6G2JARDK.js} +1 -1
- package/dist/chunks/{chunk-WIWDVETN.js → chunk-6VCQLZXE.js} +75 -76
- package/dist/chunks/{chunk-E5YD5JWR.js → chunk-BY3WDJO5.js} +1 -1
- package/dist/chunks/{chunk-IW7A2IQY.js → chunk-C4YQJFZV.js} +43 -15
- package/dist/chunks/{chunk-BQYX2UX5.js → chunk-C5PIGPGX.js} +5 -3
- package/dist/chunks/{chunk-UBRWONP4.js → chunk-EOZHSNND.js} +2 -2
- package/dist/chunks/{chunk-UQFPF4EX.js → chunk-G3ZM57PD.js} +2 -2
- package/dist/chunks/{chunk-XT77MP54.js → chunk-GOBNIGWS.js} +410 -24
- package/dist/chunks/{chunk-KY3R42RS.js → chunk-GQK6WLOS.js} +5 -3
- package/dist/chunks/{chunk-BIA2NKUG.js → chunk-HEJPVXD3.js} +5 -5
- package/dist/chunks/{chunk-ILALC2N6.js → chunk-I4C2KR2G.js} +1 -1
- package/dist/chunks/{chunk-YI2YMW5N.js → chunk-IGICM3WJ.js} +2 -2
- package/dist/chunks/chunk-IN6NXQ26.js +680 -0
- package/dist/chunks/{chunk-VBFBMM7G.js → chunk-LOVAIGM2.js} +387 -70
- package/dist/chunks/{chunk-H6YOMI3U.js → chunk-OMAGCLUE.js} +5 -3
- package/dist/chunks/{chunk-VNYOUAWV.js → chunk-QAMIIFP6.js} +11 -11
- package/dist/chunks/{chunk-QBDXJS2W.js → chunk-QZYKZ7MQ.js} +16 -8
- package/dist/chunks/{chunk-V2LASYKO.js → chunk-RR45ELVE.js} +30 -24
- package/dist/chunks/{chunk-NRYDJN4J.js → chunk-RV2JAA5I.js} +89 -8
- package/dist/chunks/{chunk-TEZHIB6T.js → chunk-SDPC7BG2.js} +5 -3
- package/dist/chunks/{chunk-T2KVJFWJ.js → chunk-SHBDXEUE.js} +4 -7
- package/dist/chunks/{chunk-P6TXQK75.js → chunk-THMBDCRA.js} +5 -3
- package/dist/chunks/chunk-TJN4PIYO.js +47 -0
- package/dist/chunks/{chunk-DTCQFTHW.js → chunk-TNFIUZ4H.js} +3 -3
- package/dist/chunks/{chunk-JFAWZX53.js → chunk-UPVAQJKS.js} +282 -131
- package/dist/chunks/{chunk-KXJA42EA.js → chunk-WPBZQVLS.js} +1 -1
- package/dist/chunks/{conflict-GFJRS6I7.js → conflict-AMNTM3FV.js} +2 -2
- package/dist/chunks/{contract-U3ZGNRWB.js → contract-PLO2V2NO.js} +2333 -4426
- package/dist/chunks/{cowork-EX7PKIDK.js → cowork-FZAXE6FO.js} +5 -4
- package/dist/chunks/{create-flow-EJZD434E.js → create-flow-2DAUN7HU.js} +16 -6
- package/dist/chunks/{data-FOODGAMF.js → data-7NXMWET4.js} +3 -3
- package/dist/chunks/{ebuilder-form-I2EOKODG.js → ebuilder-form-DEYHX6M7.js} +4 -4
- package/dist/chunks/{ehr-TE4RFNID.js → ehr-QQH2DYYA.js} +244 -151
- package/dist/chunks/{employee-DR5Y64TI.js → employee-PGMY6NI6.js} +1 -1
- package/dist/chunks/{entry-mode-ZOLSXEGX.js → entry-mode-2JTVEKMP.js} +3 -3
- package/dist/chunks/{env-TID5NFR6.js → env-2JZMXC6I.js} +2 -2
- package/dist/chunks/{esb-7L6MHYLB.js → esb-I5ZFHJUK.js} +8 -8
- package/dist/chunks/{factory-OG7BPMH5.js → factory-XIATYHU6.js} +1 -1
- package/dist/chunks/{fna-6V2ENR3Y.js → fna-3V2TL6B2.js} +5 -4
- package/dist/chunks/{group-chat-5DKPWIHL.js → group-chat-CVYUZCOQ.js} +3 -3
- package/dist/chunks/{host-TJ5VVHM7.js → host-4DP7C7YQ.js} +4 -4
- package/dist/chunks/{host-3DLYA54R.js → host-4KQCAEWA.js} +4 -4
- package/dist/chunks/{host-ONZC6AE7.js → host-4X2F3JPQ.js} +4 -4
- package/dist/chunks/{host-OGBHL75G.js → host-BD7NAM33.js} +4 -4
- package/dist/chunks/{host-VTPAWDZV.js → host-CBONEAZS.js} +4 -4
- package/dist/chunks/{host-GOJHHTPY.js → host-L37QVNIV.js} +4 -4
- package/dist/chunks/{hrm-2N7NFQDZ.js → hrm-OL3IKN7C.js} +6 -6
- package/dist/chunks/{im-XCH47ZBN.js → im-YXQWUF3R.js} +4 -4
- package/dist/chunks/{invoice-5KJ7T774.js → invoice-4WY32PR2.js} +4 -4
- package/dist/chunks/{jiuchuanhui-PL6DRPBM.js → jiuchuanhui-L6SHLONH.js} +5 -4
- package/dist/chunks/{lazy-dispatch-UATEN7H7.js → lazy-dispatch-OYE6QV24.js} +5 -5
- package/dist/chunks/{mail-Q7Z4CQ4D.js → mail-PZV2KNRU.js} +5 -4
- package/dist/chunks/{meeting-5E3BNARL.js → meeting-6SOBCC6N.js} +16 -15
- package/dist/chunks/{minute-doc-NXRE5C77.js → minute-doc-KSJSJNOH.js} +4 -4
- package/dist/chunks/{okr-3O3XNYOK.js → okr-B76FW5M2.js} +5 -4
- package/dist/chunks/{operations-EZWG72FH.js → operations-YOMEGFLV.js} +5 -5
- package/dist/chunks/{performance-Y7CPNSOR.js → performance-4VBKUPFO.js} +5 -4
- package/dist/chunks/{plan-BLGPZF5M.js → plan-HBNZRQTI.js} +5 -4
- package/dist/chunks/{project-6MZMLJMP.js → project-IV6FWK74.js} +5 -4
- package/dist/chunks/{reception-F2VT2X52.js → reception-BR5YURT6.js} +3 -3
- package/dist/chunks/{recruit-stage-4ETIBMIW.js → recruit-stage-4HQ6OGXT.js} +654 -336
- package/dist/chunks/{registry-I4DVPDMU.js → registry-7LICMV5J.js} +12 -12
- package/dist/chunks/{registry-3FYSWV3U.js → registry-JFQEFC7E.js} +3 -3
- package/dist/chunks/{registry-3UGIWH53.js → registry-JMNOXRST.js} +2 -2
- package/dist/chunks/{registry-7RS74TCK.js → registry-MZJQX65Q.js} +5 -5
- package/dist/chunks/{room-recommend-GWCVKCXW.js → room-recommend-43GLLE7Y.js} +4 -4
- package/dist/chunks/{schedule-6AN63MJQ.js → schedule-ZQ42BEW6.js} +4 -4
- package/dist/chunks/{smart-extract-SR4SJJKN.js → smart-extract-QKAEAZGM.js} +3 -3
- package/dist/chunks/{workflow-KF7FA2UQ.js → workflow-6HV7H5PC.js} +10 -7
- package/dist/index.js +34 -34
- package/dist/internal/e10/auth/commands.js +21 -1
- package/dist/internal/e10/auth/xiaoe.js +6 -2
- package/dist/internal/e10/auth-recovery.js +28 -2
- package/dist/internal/e10/request-runtime.js +15 -3
- package/dist/internal/e10/request-trace.js +65 -0
- package/dist/shortcuts/contract/data/metric-catalog.js +149 -0
- package/dist/shortcuts/contract/index.js +14 -39
- package/dist/shortcuts/contract/manifest.js +115 -270
- package/dist/shortcuts/contract/operations/compare-report.js +437 -0
- package/dist/shortcuts/contract/operations/compare.js +2 -0
- package/dist/shortcuts/contract/operations/first-screen.js +96 -207
- package/dist/shortcuts/contract/operations/flow.js +19 -1
- package/dist/shortcuts/contract/operations/{card-ebdf-list.js → ledger-card.js} +98 -25
- package/dist/shortcuts/contract/operations/ledger.js +315 -1
- package/dist/shortcuts/contract/operations/metrics.js +93 -0
- package/dist/shortcuts/contract/operations/modeltext.js +3 -3
- package/dist/shortcuts/contract/operations/page.js +8 -4
- package/dist/shortcuts/contract/operations/performance.js +53 -0
- package/dist/shortcuts/contract/operations/quote-recognize.js +289 -0
- package/dist/shortcuts/contract/operations/quote-submit.js +264 -0
- package/dist/shortcuts/contract/operations/recommend.js +42 -1
- package/dist/shortcuts/contract/operations/registry.js +16 -23
- package/dist/shortcuts/contract/operations/{card-risk-report.js → review-report.js} +24 -114
- package/dist/shortcuts/contract/operations/review.js +33 -167
- package/dist/shortcuts/contract/operations/save-recognize.js +173 -43
- package/dist/shortcuts/contract/operations/triage.js +13 -6
- package/dist/shortcuts/contract/operations/{template.js → type-clause-read.js} +10 -25
- package/dist/shortcuts/contract/operations/upload.js +17 -11
- package/dist/shortcuts/contract/prewarm-cache.js +6 -2
- package/dist/shortcuts/contract/prewarm.js +33 -23
- package/dist/shortcuts/contract/recommend-cache.js +191 -0
- package/dist/shortcuts/ehr/operations/recruit-interview-overview.js +85 -62
- package/dist/shortcuts/ehr/operations/recruit-position.js +21 -13
- package/dist/shortcuts/ehr/operations/recruit-short-cache.js +59 -0
- package/dist/shortcuts/ehr/operations/recruit-tag.js +17 -11
- package/dist/shortcuts/ehr/operations/recruit-write.js +118 -70
- package/dist/shortcuts/ehr/operations/recruit.js +338 -121
- package/dist/shortcuts/hrm/operations/employee.js +64 -17
- package/dist/shortcuts/hrm/operations/resolve.js +419 -369
- package/dist/shortcuts/im/host.js +38 -22
- package/dist/shortcuts/meeting/operations/eb/conflict.js +60 -2
- package/dist/shortcuts/meeting/operations/eb/create-flow.js +116 -7
- package/dist/shortcuts/meeting/operations/eb/create-form-link.js +380 -0
- package/dist/shortcuts/meeting/operations/eb/index.js +2 -0
- package/dist/shortcuts/meeting/operations/eb/room-recommend.js +1 -3
- package/dist/shortcuts/recruit-stage/batch-store.js +44 -0
- package/dist/shortcuts/recruit-stage/context.js +75 -9
- package/dist/shortcuts/recruit-stage/manifest.js +1 -1
- package/dist/shortcuts/recruit-stage/operations/jd-create.js +33 -22
- package/dist/shortcuts/recruit-stage/operations/list.js +187 -37
- package/dist/shortcuts/recruit-stage/operations/registry.js +2 -0
- package/dist/shortcuts/recruit-stage/operations/resume-import.js +231 -313
- package/dist/shortcuts/recruit-stage/operations/search.js +5 -5
- package/dist/shortcuts/recruit-stage/operations/tag.js +286 -0
- package/dist/shortcuts/workflow/endpoints.js +2 -0
- package/dist/shortcuts/workflow/operations/form.js +12 -15
- package/dist/shortcuts/workflow/operations/read.js +8 -8
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoListRows.js +3 -2
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +7 -6
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +4 -3
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.group.js +1 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +33 -6
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.prepareQuery.js +153 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/workflowClarification.js +232 -0
- package/dist/shortcuts/workflow/operations.js +5 -0
- package/docs/contract.md +2 -2
- package/docs/e10-auth.md +28 -0
- package/docs/ehr.md +1 -1
- package/package.json +1 -1
- package/skills/weaver-e10-hrm/SKILL.md +3 -3
- package/skills/weaver-e10-hrm/references/employee.md +13 -2
- package/skills/weaver-e10-jinchengda/SKILL.md +237 -347
- package/skills/weaver-e10-jinchengda/references/contract-agent-entry.md +7 -14
- package/skills/weaver-e10-jinchengda/references/contract-ai-assistant.md +21 -12
- package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +109 -185
- package/skills/weaver-e10-jinchengda/references/contract-clause-insert.md +12 -4
- package/skills/weaver-e10-jinchengda/references/contract-clause-library-crud.md +28 -20
- package/skills/weaver-e10-jinchengda/references/contract-clause-recommender.md +12 -17
- package/skills/weaver-e10-jinchengda/references/contract-clause-reference-save.md +7 -13
- package/skills/weaver-e10-jinchengda/references/contract-command-index.md +21 -12
- package/skills/weaver-e10-jinchengda/references/contract-compare-report-template.html +10 -18
- package/skills/weaver-e10-jinchengda/references/contract-compare-report.md +18 -17
- package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +114 -61
- package/skills/weaver-e10-jinchengda/references/contract-disabled-capabilities.md +8 -2
- package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +73 -104
- package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +32 -37
- package/skills/weaver-e10-jinchengda/references/contract-element-extract.md +12 -10
- package/skills/weaver-e10-jinchengda/references/contract-element-save-record.md +70 -82
- package/skills/weaver-e10-jinchengda/references/contract-execution-rules.md +37 -33
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-new-customer.md +94 -27
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +5 -5
- package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +9 -15
- package/skills/weaver-e10-jinchengda/references/contract-ledger-catalog.md +9 -4
- package/skills/weaver-e10-jinchengda/references/contract-ledger-query-playbook.md +59 -32
- package/skills/weaver-e10-jinchengda/references/contract-ledger-rules.md +7 -5
- package/skills/weaver-e10-jinchengda/references/contract-modeltext-library.md +21 -13
- package/skills/weaver-e10-jinchengda/references/contract-multi-file.md +13 -13
- package/skills/weaver-e10-jinchengda/references/contract-object-detect.md +6 -5
- package/skills/weaver-e10-jinchengda/references/contract-open-web-pages.md +250 -0
- package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +11 -20
- package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +203 -54
- package/skills/weaver-e10-jinchengda/references/contract-request-status.md +4 -11
- package/skills/weaver-e10-jinchengda/references/contract-request-write.md +11 -17
- package/skills/weaver-e10-jinchengda/references/contract-signing-subjects.md +11 -17
- package/skills/weaver-e10-jinchengda/references/contract-subject-create.md +5 -11
- package/skills/weaver-e10-jinchengda/references/contract-template-recommend.md +56 -7
- package/skills/weaver-e10-jinchengda/references/contract-workflow-discovery.md +10 -16
- package/skills/weaver-e10-jinchengda/references/orchestration.md +31 -33
- package/skills/weaver-e10-jucailin/SKILL.md +6 -7
- package/skills/weaver-e10-jucailin/agents/openai.yaml +52 -0
- package/skills/weaver-e10-jucailin/references/recruit-interview-overview.md +8 -6
- package/skills/weaver-e10-jucailin/references/recruit-read.md +4 -0
- package/skills/weaver-e10-jucailin/references/recruit-screening-to-interview-sop.md +2 -2
- package/skills/weaver-e10-jucailin/references/recruit-write.md +4 -4
- package/skills/weaver-e10-meeting/SKILL.md +83 -531
- package/skills/weaver-e10-meeting/references/commands-table.md +61 -0
- package/skills/weaver-e10-meeting/references/create-commands.md +136 -0
- package/skills/weaver-e10-meeting/references/create-flow.md +3 -1
- package/skills/weaver-e10-meeting/references/create-guardrails.md +14 -8
- package/skills/weaver-e10-meeting/references/custom-fields.md +40 -0
- package/skills/weaver-e10-meeting/references/eb-contracts.md +60 -0
- package/skills/weaver-e10-meeting/references/invitation.md +69 -0
- package/skills/weaver-e10-meeting/references/minutes-pipeline.md +119 -0
- package/skills/weaver-e10-meeting/references/pitfalls.md +1 -1
- package/skills/weaver-e10-meeting/references/room-recommend.md +88 -0
- package/skills/weaver-e10-recruit-stage/SKILL.md +317 -266
- package/skills/weaver-e10-recruit-stage/agents/openai.yaml +22 -27
- package/skills/weaver-e10-recruit-stage/references/env-ziyong.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +30 -27
- package/skills/weaver-e10-recruit-stage/references/recruit-capability-check.md +2 -6
- package/skills/weaver-e10-recruit-stage/references/recruit-edit-interview-feedback.md +12 -10
- package/skills/weaver-e10-recruit-stage/references/recruit-interview-not-attended.md +2 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +23 -19
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-template.md +3 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-list-candidate.md +18 -16
- package/skills/weaver-e10-recruit-stage/references/recruit-list-interview.md +25 -23
- package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +10 -10
- package/skills/weaver-e10-recruit-stage/references/recruit-resolve-metadata.md +2 -2
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import-batch.md +11 -11
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +150 -85
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-parse.md +14 -18
- package/skills/weaver-e10-recruit-stage/references/recruit-search-by-tag.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-tag-recommend.md +173 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-tag-taxonomy.json +76 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-urge-feedback.md +3 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +2 -2
- package/skills/weaver-e10-workflow/SKILL.md +49 -32
- package/skills/weaver-e10-workflow/references/todo-dialogue.md +67 -34
- package/skills/weaver-e10-workflow/references/todo-smart-convert.md +65 -51
- package/skills/weaver-e10-workflow/references/workflow-agent-entry.md +18 -11
- package/skills/weaver-e10-workflow/references/workflow-create.md +2 -2
- package/skills/weaver-e10-workflow/references/workflow-memory.md +19 -37
- package/skills/weaver-e10-workflow/references/workflow-query.md +25 -22
- package/skills/weaver-e10-workflow/references/workflow-view.md +1 -1
- package/skills/weaver-e10-workflow/tools/todo-summary.cjs +318 -110
- package/skills/weaver-e10-yimiaoban/SKILL.md +10 -10
- package/skills/weaver-e10-yimiaoban/references/person.md +1 -1
- package/skills/weaver-e10-yimiaoban/references/safety-boundaries.md +1 -1
- package/skills/weaver-e10-yimiaoban/references/source-manifest.json +9 -9
- package/dist/chunks/chunk-6QYNE6HE.js +0 -658
- package/dist/chunks/chunk-SHYQUBY3.js +0 -48
- package/dist/shortcuts/contract/operations/card-action.js +0 -1266
- package/dist/shortcuts/contract/operations/card-plan.js +0 -393
- package/dist/shortcuts/contract/operations/card.js +0 -232
- package/dist/shortcuts/contract/operations/compare-screen.js +0 -378
- package/dist/shortcuts/contract/operations/quote-to-contract.js +0 -495
- package/dist/shortcuts/contract/operations/quotescreen.js +0 -529
- package/dist/shortcuts/contract/operations/summary-validate.js +0 -293
- package/dist/shortcuts/contract/operations/summary.js +0 -187
- package/dist/shortcuts/ehr/recruit-stage/batch-store.js +0 -78
- package/dist/shortcuts/ehr/recruit-stage/context.js +0 -231
- package/dist/shortcuts/ehr/recruit-stage/continuation.js +0 -74
- package/dist/shortcuts/ehr/recruit-stage/errors.js +0 -65
- package/dist/shortcuts/ehr/recruit-stage/fs-scan.js +0 -165
- package/dist/shortcuts/ehr/recruit-stage/host.js +0 -109
- package/dist/shortcuts/ehr/recruit-stage/operations/interview-arrange.js +0 -1065
- package/dist/shortcuts/ehr/recruit-stage/operations/interview-feedback.js +0 -295
- package/dist/shortcuts/ehr/recruit-stage/operations/jd-create.js +0 -961
- package/dist/shortcuts/ehr/recruit-stage/operations/list.js +0 -431
- package/dist/shortcuts/ehr/recruit-stage/operations/registry.js +0 -50
- package/dist/shortcuts/ehr/recruit-stage/operations/resume-import.js +0 -1655
- package/dist/shortcuts/ehr/recruit-stage/operations/search.js +0 -158
- package/dist/shortcuts/ehr/recruit-stage/operations/types.js +0 -34
- package/dist/shortcuts/ehr/recruit-stage/runtime.js +0 -31
- package/dist/shortcuts/ehr/recruit-stage/school-tiers.json +0 -318
- package/dist/shortcuts/ehr/recruit-stage/shared.js +0 -887
- package/skills/weaver-e10-jinchengda/references/contract-action-card-template.html +0 -22
- package/skills/weaver-e10-jinchengda/references/contract-action-card.md +0 -554
- package/skills/weaver-e10-jinchengda/references/contract-action-engine.md +0 -279
- package/skills/weaver-e10-jinchengda/references/contract-card-render-internals.md +0 -483
- package/skills/weaver-e10-jinchengda/references/contract-template-selector.md +0 -46
- package/skills/weaver-e10-recruit-stage/lib/recruit-resume-photo.py +0 -194
|
@@ -3,7 +3,7 @@ const require = __esbuildCreateRequire(import.meta.url);
|
|
|
3
3
|
import {
|
|
4
4
|
createRecruitContextLoader,
|
|
5
5
|
ehrValidationError
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-UPVAQJKS.js";
|
|
7
7
|
import {
|
|
8
8
|
CONTINUATION_TTL_MS
|
|
9
9
|
} from "./chunk-7BDPM5ST.js";
|
|
@@ -12,12 +12,13 @@ import {
|
|
|
12
12
|
createE10RequestRuntime,
|
|
13
13
|
isE10SessionExpiredResponse,
|
|
14
14
|
requireE10Session
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-RV2JAA5I.js";
|
|
16
|
+
import {
|
|
17
|
+
E10_SESSION_EXPIRED_MESSAGE
|
|
18
|
+
} from "./chunk-TJN4PIYO.js";
|
|
16
19
|
import {
|
|
17
|
-
E10_SESSION_EXPIRED_MESSAGE,
|
|
18
20
|
getActiveProfile
|
|
19
|
-
} from "./chunk-
|
|
20
|
-
import "./chunk-SHYQUBY3.js";
|
|
21
|
+
} from "./chunk-6VCQLZXE.js";
|
|
21
22
|
import {
|
|
22
23
|
CliError,
|
|
23
24
|
isCliError,
|
|
@@ -1077,6 +1078,29 @@ function refToSubmit(d) {
|
|
|
1077
1078
|
return o;
|
|
1078
1079
|
}
|
|
1079
1080
|
var WORK_PLACE_NAMES = ["\u529E\u516C\u5730\u70B9", "\u5DE5\u4F5C\u5730\u70B9"];
|
|
1081
|
+
var allMenusMemo = /* @__PURE__ */ new Map();
|
|
1082
|
+
async function fetchAllMenusFlat(ctx) {
|
|
1083
|
+
const key = `${ctx.baseUrl}|${ctx.appId}`;
|
|
1084
|
+
const memo = allMenusMemo.get(key);
|
|
1085
|
+
if (memo) return memo;
|
|
1086
|
+
try {
|
|
1087
|
+
const r = await ctx.host.request({
|
|
1088
|
+
path: `/api/cusapp/app/allMenus?isFront=1&appId=${ctx.appId}&terminalType=PC`,
|
|
1089
|
+
method: "GET"
|
|
1090
|
+
});
|
|
1091
|
+
const flat = [];
|
|
1092
|
+
(function walk2(ns) {
|
|
1093
|
+
for (const n of ns || []) if (n && typeof n === "object") {
|
|
1094
|
+
flat.push(n);
|
|
1095
|
+
walk2(n.children || n.childs);
|
|
1096
|
+
}
|
|
1097
|
+
})(r?.data?.cusAppMenus || r?.data);
|
|
1098
|
+
allMenusMemo.set(key, flat);
|
|
1099
|
+
return flat;
|
|
1100
|
+
} catch {
|
|
1101
|
+
return [];
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1080
1104
|
async function findWorkPlaceMenu(ctx) {
|
|
1081
1105
|
const { host, appId, cache } = ctx;
|
|
1082
1106
|
const ok = (m) => m && m.listId;
|
|
@@ -1086,14 +1110,7 @@ async function findWorkPlaceMenu(ctx) {
|
|
|
1086
1110
|
const hit2 = findMenuNode(cache.menus || [], WORK_PLACE_NAMES, (m) => ok(m));
|
|
1087
1111
|
if (hit2) return { listId: String(hit2.listId), cusMenuId: String(hit2.cusMenuId || ""), menuName: String(hit2.menuName || "") };
|
|
1088
1112
|
try {
|
|
1089
|
-
const
|
|
1090
|
-
const flat = [];
|
|
1091
|
-
(function walk2(ns) {
|
|
1092
|
-
for (const n of ns || []) if (n && typeof n === "object") {
|
|
1093
|
-
flat.push(n);
|
|
1094
|
-
walk2(n.children || n.childs);
|
|
1095
|
-
}
|
|
1096
|
-
})(r?.data?.cusAppMenus || r?.data);
|
|
1113
|
+
const flat = await fetchAllMenusFlat(ctx);
|
|
1097
1114
|
const hit3 = findMenuNode(flat, WORK_PLACE_NAMES, (m) => ok(m));
|
|
1098
1115
|
if (hit3) return { listId: String(hit3.listId), cusMenuId: String(hit3.cusMenuId || ""), menuName: String(hit3.menuName || "") };
|
|
1099
1116
|
} catch {
|
|
@@ -1255,29 +1272,15 @@ async function resolvePositionNewUrl(ctx) {
|
|
|
1255
1272
|
const cached = cache.menus?.find?.((m) => m.combinationId && m.id && m.pageId && ["\u62DB\u8058\u804C\u4F4D", "\u804C\u4F4D\u5217\u8868", "\u804C\u4F4D\u7BA1\u7406"].some((n) => (m.menuName || "").includes(n)));
|
|
1256
1273
|
let node = cached || null;
|
|
1257
1274
|
if (!node) {
|
|
1258
|
-
const
|
|
1259
|
-
const flat = [];
|
|
1260
|
-
(function walk2(ns) {
|
|
1261
|
-
for (const n of ns || []) if (n && typeof n === "object") {
|
|
1262
|
-
flat.push(n);
|
|
1263
|
-
walk2(n.children || n.childs);
|
|
1264
|
-
}
|
|
1265
|
-
})(r?.data?.cusAppMenus || r?.data);
|
|
1275
|
+
const flat = await fetchAllMenusFlat(ctx);
|
|
1266
1276
|
node = findMenuNode(flat, ["\u62DB\u8058\u804C\u4F4D", "\u804C\u4F4D\u5217\u8868", "\u804C\u4F4D\u7BA1\u7406"], (n) => n.combinationId && n.id && n.pageId);
|
|
1267
1277
|
}
|
|
1268
1278
|
if (!node) return null;
|
|
1269
1279
|
return `${baseUrl}/ebdapp/view/${appId}/combination/${node.combinationId}-${node.id}/search/${node.pageId}?terminal=PC&cusMenuId=${node.id}`;
|
|
1270
1280
|
}
|
|
1271
1281
|
async function resolveHomePageUrl(ctx) {
|
|
1272
|
-
const {
|
|
1273
|
-
const
|
|
1274
|
-
const flat = [];
|
|
1275
|
-
(function walk2(ns) {
|
|
1276
|
-
for (const n of ns || []) if (n && typeof n === "object") {
|
|
1277
|
-
flat.push(n);
|
|
1278
|
-
walk2(n.children || n.childs);
|
|
1279
|
-
}
|
|
1280
|
-
})(r?.data?.cusAppMenus || r?.data);
|
|
1282
|
+
const { baseUrl, appId } = ctx;
|
|
1283
|
+
const flat = await fetchAllMenusFlat(ctx);
|
|
1281
1284
|
const node = findMenuNode(flat, ["\u62DB\u8058\u9996\u9875", "\u62DB\u8058\u4E3B\u9875"], (n) => n.pageType === "PAGE" && n.pageId && n.id) || flat.find((n) => n.pageType === "PAGE" && String(n.menuName || "").includes("\u9996\u9875"));
|
|
1282
1285
|
if (!node || !node.pageId || !node.id) return null;
|
|
1283
1286
|
return `${baseUrl}/ebdapp/view/${appId}/PAGE/${node.pageId}-${node.id}?terminal=PC&cusMenuId=${node.id}&appId_${node.pageId}=${appId}`;
|
|
@@ -2365,20 +2368,6 @@ function scanResumeSource(source) {
|
|
|
2365
2368
|
files.sort((a, b) => a.name.localeCompare(b.name, "zh-Hans-CN"));
|
|
2366
2369
|
return { root, files, warnings, tempDir };
|
|
2367
2370
|
}
|
|
2368
|
-
function findStructuredJson(file, structuredDir) {
|
|
2369
|
-
const base = basename(file.name, extname(file.name));
|
|
2370
|
-
const candidates = [
|
|
2371
|
-
join2(dirname(file.path), base + ".json"),
|
|
2372
|
-
...structuredDir ? [join2(resolve2(structuredDir), base + ".json")] : []
|
|
2373
|
-
];
|
|
2374
|
-
for (const c of candidates) {
|
|
2375
|
-
try {
|
|
2376
|
-
if (statSync(c).isFile()) return c;
|
|
2377
|
-
} catch {
|
|
2378
|
-
}
|
|
2379
|
-
}
|
|
2380
|
-
return null;
|
|
2381
|
-
}
|
|
2382
2371
|
|
|
2383
2372
|
// src/shortcuts/recruit-stage/batch-store.ts
|
|
2384
2373
|
import { createHash as createHash2 } from "node:crypto";
|
|
@@ -2440,8 +2429,47 @@ function loadBatchItems(file, expectedFingerprint) {
|
|
|
2440
2429
|
}
|
|
2441
2430
|
return items;
|
|
2442
2431
|
}
|
|
2432
|
+
function ocrFile(fileId) {
|
|
2433
|
+
const safe = String(fileId || "").replace(/[^0-9A-Za-z_-]/g, "");
|
|
2434
|
+
if (!safe) throw rsValidationError("ocr_cache_key_invalid", "OCR \u7F13\u5B58\u952E\u975E\u6CD5\uFF08fileId \u4E3A\u7A7A\uFF09");
|
|
2435
|
+
return join3(batchDir(), `ocr-${safe}.json`);
|
|
2436
|
+
}
|
|
2437
|
+
function saveOcrResult(fileId, structured) {
|
|
2438
|
+
if (process.env.E10_OCR_NO_CACHE === "1") return;
|
|
2439
|
+
try {
|
|
2440
|
+
const dir = batchDir();
|
|
2441
|
+
cleanup(dir);
|
|
2442
|
+
const p = ocrFile(fileId);
|
|
2443
|
+
writeFileSync2(p, JSON.stringify(structured), { mode: 384 });
|
|
2444
|
+
try {
|
|
2445
|
+
chmodSync(p, 384);
|
|
2446
|
+
} catch {
|
|
2447
|
+
}
|
|
2448
|
+
} catch {
|
|
2449
|
+
}
|
|
2450
|
+
}
|
|
2451
|
+
function loadOcrResult(fileId, maxAgeMs = 24 * 3600 * 1e3) {
|
|
2452
|
+
if (process.env.E10_OCR_NO_CACHE === "1") return null;
|
|
2453
|
+
try {
|
|
2454
|
+
const p = ocrFile(fileId);
|
|
2455
|
+
const st = statSync2(p);
|
|
2456
|
+
if (Date.now() - st.mtimeMs > maxAgeMs) return null;
|
|
2457
|
+
const v = JSON.parse(readFileSync2(p, "utf8"));
|
|
2458
|
+
return v && typeof v === "object" && !Array.isArray(v) ? v : null;
|
|
2459
|
+
} catch {
|
|
2460
|
+
return null;
|
|
2461
|
+
}
|
|
2462
|
+
}
|
|
2443
2463
|
|
|
2444
2464
|
// src/shortcuts/recruit-stage/operations/resume-import.ts
|
|
2465
|
+
var tracePrev = 0;
|
|
2466
|
+
function mark(label) {
|
|
2467
|
+
if (process.env.E10_TRACE_MS !== "1") return;
|
|
2468
|
+
const now = performance.now();
|
|
2469
|
+
const delta = tracePrev ? now - tracePrev : 0;
|
|
2470
|
+
tracePrev = now;
|
|
2471
|
+
console.error(`[trace] ${label} +${delta.toFixed(0)}ms t=${now.toFixed(0)}`);
|
|
2472
|
+
}
|
|
2445
2473
|
var PROTECTED_UPDATE_KEYS = ["is_blacklist", "recruit_status", "candidate_status", "data_status"];
|
|
2446
2474
|
async function uploadResume(host, baseUrl, filePath, fieldId, formId) {
|
|
2447
2475
|
const buf = fs.readFileSync(filePath);
|
|
@@ -2473,6 +2501,7 @@ async function uploadResume(host, baseUrl, filePath, fieldId, formId) {
|
|
|
2473
2501
|
return fd2;
|
|
2474
2502
|
};
|
|
2475
2503
|
const c = await host.request({ path: "/api/file/preUploadCheck", method: "POST", multipart: withFile(), headers });
|
|
2504
|
+
mark("upload.preUploadCheck");
|
|
2476
2505
|
const preUploadId = c?.data?.preUploadId;
|
|
2477
2506
|
const uploadType = c?.data?.uploadType || "common";
|
|
2478
2507
|
if (!preUploadId) throw rsFail("\u7B80\u5386\u9884\u4E0A\u4F20\u68C0\u67E5\u5931\u8D25\uFF1A" + JSON.stringify(c || {}).slice(0, 200));
|
|
@@ -2487,6 +2516,7 @@ async function uploadResume(host, baseUrl, filePath, fieldId, formId) {
|
|
|
2487
2516
|
fd.append("uploadType", String(uploadType));
|
|
2488
2517
|
fd.append("file", new Blob([buf]), filename);
|
|
2489
2518
|
const j = await host.request({ path: "/api/file/module/upload", method: "POST", multipart: fd, headers });
|
|
2519
|
+
mark("upload.moduleUpload");
|
|
2490
2520
|
if (!j?.data?.fileid) throw rsFail("\u7B80\u5386\u4E0A\u4F20\u5931\u8D25\uFF1A" + JSON.stringify(j || {}).slice(0, 200));
|
|
2491
2521
|
return { fileid: String(j.data.fileid), name: j.data.name || filename };
|
|
2492
2522
|
}
|
|
@@ -2505,12 +2535,29 @@ async function writeAvatarIfProvided(ctx, opts) {
|
|
|
2505
2535
|
return { written: false, warning: "\u5934\u50CF\u5199\u5165\u5931\u8D25\uFF08\u5DF2\u8DF3\u8FC7\uFF0C\u4E0D\u5F71\u54CD\u5EFA\u6863\uFF09\uFF1A" + (e?.message || e) };
|
|
2506
2536
|
}
|
|
2507
2537
|
}
|
|
2508
|
-
|
|
2538
|
+
var PARSED_SNAPSHOT_LIMIT = 80 * 1024;
|
|
2539
|
+
function snapshotParsedResume(s) {
|
|
2540
|
+
if (!s || typeof s !== "object") return void 0;
|
|
2541
|
+
try {
|
|
2542
|
+
const raw = JSON.stringify(s);
|
|
2543
|
+
if (raw.length > PARSED_SNAPSHOT_LIMIT) return void 0;
|
|
2544
|
+
return s;
|
|
2545
|
+
} catch {
|
|
2546
|
+
return void 0;
|
|
2547
|
+
}
|
|
2548
|
+
}
|
|
2549
|
+
async function checkExtractionGate(host) {
|
|
2509
2550
|
const b = await host.request({ path: "/api/recruit/ocr/checkResumeExtraction", method: "POST", body: {} });
|
|
2510
|
-
|
|
2551
|
+
mark("ocr.checkResumeExtraction");
|
|
2552
|
+
if (b?.data !== true) {
|
|
2553
|
+
throw rsFail("\u5F53\u524D\u73AF\u5883\u672A\u5F00\u542F\u7B80\u5386\u62BD\u53D6\uFF08checkResumeExtraction=false\uFF09\uFF1A\u8BF7\u5728 E10 \u540E\u53F0\u5F00\u542F\u300C\u7B80\u5386\u62BD\u53D6\u300D\u80FD\u529B\u540E\u539F\u8DEF\u5F84\u91CD\u8BD5\uFF1B\u672C CLI \u4E0D\u63A5\u53D7\u7ED3\u6784\u5316\u6587\u672C\u8F93\u5165\u515C\u5E95");
|
|
2554
|
+
}
|
|
2555
|
+
}
|
|
2556
|
+
async function extractResume(host, fileid) {
|
|
2511
2557
|
const r = await host.request({ path: "/api/recruit/ocr/resumeExtraction?fileId=" + encodeURIComponent(fileid), method: "POST" });
|
|
2558
|
+
mark("ocr.resumeExtraction");
|
|
2512
2559
|
const d = r?.data?.data;
|
|
2513
|
-
if (!d || typeof d !== "object") throw rsFail("\u672A\u4ECE\u6587\u4EF6\u4E2D\u89E3\u6790\u51FA\u7B80\u5386\u4FE1\u606F\uFF08\u53EF\u80FD\u662F\u975E\u7B80\u5386\u6587\u4EF6\uFF09");
|
|
2560
|
+
if (!d || typeof d !== "object") throw rsFail("\u672A\u4ECE\u6587\u4EF6\u4E2D\u89E3\u6790\u51FA\u7B80\u5386\u4FE1\u606F\uFF08\u53EF\u80FD\u662F\u975E\u7B80\u5386\u6587\u4EF6\uFF09\uFF0C\u8BF7\u786E\u8BA4\u4E0A\u4F20\u7684\u662F\u7B80\u5386\u539F\u4EF6");
|
|
2514
2561
|
return d;
|
|
2515
2562
|
}
|
|
2516
2563
|
function mapToTalent(fields, s) {
|
|
@@ -2831,145 +2878,6 @@ function deriveSchoolTags(structured) {
|
|
|
2831
2878
|
}
|
|
2832
2879
|
return { candidates, detail, schools };
|
|
2833
2880
|
}
|
|
2834
|
-
function normalizeTextStructured(cache, s, warnings) {
|
|
2835
|
-
const raw = cache.dict?.raw || [];
|
|
2836
|
-
const byName = cache.dict?.by_name || {};
|
|
2837
|
-
const dictIdByName2 = (name) => {
|
|
2838
|
-
const k = String(name || "").trim();
|
|
2839
|
-
if (!k) return "";
|
|
2840
|
-
let ids = byName[k];
|
|
2841
|
-
if (!ids || !ids.length) ids = raw.filter((x) => x.selection_name === k).map((x) => x.option_id);
|
|
2842
|
-
const uniq = [...new Set((ids || []).map(String))];
|
|
2843
|
-
if (!uniq.length) {
|
|
2844
|
-
warnings.push("\u5B57\u5178\u672A\u627E\u5230\u300C" + k + "\u300D\u2192 \u8BE5\u5B57\u6BB5\u8DF3\u8FC7");
|
|
2845
|
-
return "";
|
|
2846
|
-
}
|
|
2847
|
-
if (uniq.length > 1) {
|
|
2848
|
-
warnings.push("\u5B57\u5178\u300C" + k + "\u300D\u547D\u4E2D " + uniq.length + " \u4E2A\u540C\u540D\u9009\u9879\uFF08\u6B67\u4E49\uFF09\u2192 \u8BE5\u5B57\u6BB5\u8DF3\u8FC7");
|
|
2849
|
-
return "";
|
|
2850
|
-
}
|
|
2851
|
-
return uniq[0];
|
|
2852
|
-
};
|
|
2853
|
-
const fixRows = (rows, keys) => {
|
|
2854
|
-
for (const r of rows || []) {
|
|
2855
|
-
if (!r || typeof r !== "object") continue;
|
|
2856
|
-
for (const k of keys) {
|
|
2857
|
-
const v = String(r[k] || "").trim();
|
|
2858
|
-
if (!v || /^\d{6,}$/.test(v)) continue;
|
|
2859
|
-
const id = dictIdByName2(v);
|
|
2860
|
-
if (id) r[k] = id;
|
|
2861
|
-
else delete r[k];
|
|
2862
|
-
}
|
|
2863
|
-
}
|
|
2864
|
-
};
|
|
2865
|
-
if (!s.gender && s.genderName) {
|
|
2866
|
-
const id = dictIdByName2(s.genderName);
|
|
2867
|
-
if (id) s.gender = id;
|
|
2868
|
-
}
|
|
2869
|
-
if (!s.highest_degree && s.highest_degree_name) {
|
|
2870
|
-
const id = dictIdByName2(s.highest_degree_name);
|
|
2871
|
-
if (id) s.highest_degree = id;
|
|
2872
|
-
}
|
|
2873
|
-
fixRows(s.academicInformations, ["edu_education", "degree"]);
|
|
2874
|
-
fixRows(s.jobInformations || s.workExperiences, ["work_type"]);
|
|
2875
|
-
fixRows(s.internshipExperiences, ["sx_work_type"]);
|
|
2876
|
-
fixRows(s.languageAbilities, ["mastery", "ls_ability", "literacy"]);
|
|
2877
|
-
return s;
|
|
2878
|
-
}
|
|
2879
|
-
var DATE_ONLY_RE = /^\d{4}-\d{2}-\d{2}$/;
|
|
2880
|
-
var ONGOING_RE = /至今|现在|今|now|present/i;
|
|
2881
|
-
var RE_RANGE_FULL = /^\s*(\d{4}[.\-/年]\d{1,2}[.\-/月]\d{1,2}\s*日?)\s*[-–—~至,,]\s*(\d{4}[.\-/年]\d{1,2}[.\-/月]\d{1,2}\s*日?|至今|现在|今)\s*$/;
|
|
2882
|
-
var RE_RANGE_YM = /^\s*(\d{4}[.\-/年]\d{1,2})\s*[-–—~至,,]\s*(\d{4}[.\-/年]\d{1,2}|至今|现在|今)\s*$/;
|
|
2883
|
-
function normDatePart(raw, isEnd) {
|
|
2884
|
-
const s = String(raw ?? "").trim();
|
|
2885
|
-
if (!s) return "";
|
|
2886
|
-
if (ONGOING_RE.test(s)) return "";
|
|
2887
|
-
if (DATE_ONLY_RE.test(s)) return s;
|
|
2888
|
-
const m = s.match(/^(\d{4})\s*[.\-/年]?\s*(\d{1,2})?\s*[.\-/月]?\s*(\d{1,2})?\s*日?$/);
|
|
2889
|
-
if (!m) return "";
|
|
2890
|
-
const y = Number(m[1]);
|
|
2891
|
-
const mo = m[2] ? Number(m[2]) : 1;
|
|
2892
|
-
if (!y || mo < 1 || mo > 12) return "";
|
|
2893
|
-
const lastDay = new Date(y, mo, 0).getDate();
|
|
2894
|
-
let d;
|
|
2895
|
-
if (m[3]) {
|
|
2896
|
-
d = Number(m[3]);
|
|
2897
|
-
if (d < 1 || d > lastDay) return "";
|
|
2898
|
-
} else {
|
|
2899
|
-
d = isEnd ? lastDay : 1;
|
|
2900
|
-
}
|
|
2901
|
-
return y + "-" + String(mo).padStart(2, "0") + "-" + String(d).padStart(2, "0");
|
|
2902
|
-
}
|
|
2903
|
-
function normDateRange(raw) {
|
|
2904
|
-
const s = Array.isArray(raw) ? raw.map((x) => String(x ?? "").trim()).filter(Boolean).join(",") : String(raw ?? "").trim();
|
|
2905
|
-
if (!s) return "";
|
|
2906
|
-
const m = s.match(RE_RANGE_FULL) || s.match(RE_RANGE_YM);
|
|
2907
|
-
if (m) {
|
|
2908
|
-
const a = normDatePart(m[1], false);
|
|
2909
|
-
if (!a) return "";
|
|
2910
|
-
const b = normDatePart(m[2], true);
|
|
2911
|
-
return b ? a + "," + b : a;
|
|
2912
|
-
}
|
|
2913
|
-
return normDatePart(s, false);
|
|
2914
|
-
}
|
|
2915
|
-
function normalizeDates(s, warnings) {
|
|
2916
|
-
if (!s || typeof s !== "object") return;
|
|
2917
|
-
const one = (label, val, isEnd = false) => {
|
|
2918
|
-
const before = String(val ?? "").trim();
|
|
2919
|
-
if (!before) return "";
|
|
2920
|
-
if (ONGOING_RE.test(before)) return "";
|
|
2921
|
-
const after = normDatePart(before, isEnd);
|
|
2922
|
-
if (!after) {
|
|
2923
|
-
warnings.push("\u65E5\u671F\u65E0\u6CD5\u8BC6\u522B\uFF0C\u5DF2\u8DF3\u8FC7\u8BE5\u5B57\u6BB5\uFF08\u907F\u514D\u63A5\u53E3\u6574\u6279\u6821\u9A8C\u5931\u8D25\uFF09\uFF1A" + label + " = \u300C" + before + "\u300D");
|
|
2924
|
-
return "";
|
|
2925
|
-
}
|
|
2926
|
-
if (after !== before) warnings.push("\u65E5\u671F\u5DF2\u89C4\u8303\u5316\uFF1A" + label + " \u300C" + before + "\u300D\u2192\u300C" + after + "\u300D");
|
|
2927
|
-
return after;
|
|
2928
|
-
};
|
|
2929
|
-
for (const k of ["joinworkdate", "graduate_date", "birthday"]) {
|
|
2930
|
-
if (s[k] === void 0 || s[k] === null) continue;
|
|
2931
|
-
s[k] = one(k, s[k], false);
|
|
2932
|
-
}
|
|
2933
|
-
if (Array.isArray(s.academicInformations)) {
|
|
2934
|
-
for (let i = 0; i < s.academicInformations.length; i++) {
|
|
2935
|
-
const r = s.academicInformations[i];
|
|
2936
|
-
if (!r || typeof r !== "object" || r.study_date === void 0) continue;
|
|
2937
|
-
const before = String(r.study_date ?? "").trim();
|
|
2938
|
-
if (!before) continue;
|
|
2939
|
-
const after = normDateRange(before);
|
|
2940
|
-
if (!after) {
|
|
2941
|
-
warnings.push("\u65E5\u671F\u533A\u95F4\u65E0\u6CD5\u8BC6\u522B\uFF0C\u5DF2\u8DF3\u8FC7\uFF08\u907F\u514D\u63A5\u53E3\u6574\u6279\u6821\u9A8C\u5931\u8D25\uFF09\uFF1AacademicInformations[" + i + "].study_date = \u300C" + before + "\u300D");
|
|
2942
|
-
r.study_date = "";
|
|
2943
|
-
} else {
|
|
2944
|
-
if (after !== before) warnings.push("\u65E5\u671F\u5DF2\u89C4\u8303\u5316\uFF1AacademicInformations[" + i + "].study_date \u300C" + before + "\u300D\u2192\u300C" + after + "\u300D");
|
|
2945
|
-
r.study_date = after;
|
|
2946
|
-
}
|
|
2947
|
-
}
|
|
2948
|
-
}
|
|
2949
|
-
for (const key of ["jobInformations", "workExperiences", "projectExperiences"]) {
|
|
2950
|
-
const arr = s[key];
|
|
2951
|
-
if (!Array.isArray(arr)) continue;
|
|
2952
|
-
for (let i = 0; i < arr.length; i++) {
|
|
2953
|
-
const r = arr[i];
|
|
2954
|
-
if (!r || typeof r !== "object") continue;
|
|
2955
|
-
if (r.start_date !== void 0 && r.start_date !== null) {
|
|
2956
|
-
r.start_date = one(key + "[" + i + "].start_date", r.start_date, false);
|
|
2957
|
-
}
|
|
2958
|
-
if (r.end_date !== void 0 && r.end_date !== null) {
|
|
2959
|
-
r.end_date = one(key + "[" + i + "].end_date", r.end_date, true);
|
|
2960
|
-
}
|
|
2961
|
-
}
|
|
2962
|
-
}
|
|
2963
|
-
for (const [key, field] of [["internshipExperiences", "entry_time"], ["awardExperiences", "award_date"]]) {
|
|
2964
|
-
const arr = s[key];
|
|
2965
|
-
if (!Array.isArray(arr)) continue;
|
|
2966
|
-
for (let i = 0; i < arr.length; i++) {
|
|
2967
|
-
const r = arr[i];
|
|
2968
|
-
if (!r || typeof r !== "object") continue;
|
|
2969
|
-
if (r[field] !== void 0 && r[field] !== null) r[field] = one(key + "[" + i + "]." + field, r[field], false);
|
|
2970
|
-
}
|
|
2971
|
-
}
|
|
2972
|
-
}
|
|
2973
2881
|
async function verifySubRows(ctx, formId, objId, dataId) {
|
|
2974
2882
|
const L = await getFormLayoutMeta(ctx.host, formId);
|
|
2975
2883
|
const r = await ctx.host.request({
|
|
@@ -3007,54 +2915,41 @@ async function verifySubRows(ctx, formId, objId, dataId) {
|
|
|
3007
2915
|
rowTotal: Object.values(rowsBySubFormId).reduce((a, b) => a + b, 0)
|
|
3008
2916
|
};
|
|
3009
2917
|
}
|
|
3010
|
-
async function loadStructured(ctx, args) {
|
|
3011
|
-
const warnings = [];
|
|
3012
|
-
if (args.structured !== void 0) {
|
|
3013
|
-
const s = typeof args.structured === "string" ? JSON.parse(args.structured) : args.structured;
|
|
3014
|
-
if (!s || typeof s !== "object") throw rsValidationError("structured_invalid", "structured \u5FC5\u987B\u662F JSON \u5BF9\u8C61");
|
|
3015
|
-
if (!String(s.telephone || "").trim() && !String(s.candidateName || "").trim()) {
|
|
3016
|
-
throw rsValidationError("structured_invalid", "\u7ED3\u6784\u5316\u7B80\u5386\u7F3A\u5C11 telephone \u4E0E candidateName\uFF08\u81F3\u5C11\u8981\u6709\u624B\u673A\u53F7\u6216\u59D3\u540D\uFF0C\u5426\u5219\u65E0\u6CD5\u67E5\u91CD\u5EFA\u6863\uFF09");
|
|
3017
|
-
}
|
|
3018
|
-
const normalizedInline = normalizeTextStructured(ctx.cache, s, warnings);
|
|
3019
|
-
normalizeDates(normalizedInline, warnings);
|
|
3020
|
-
return { structured: normalizedInline, textMode: true, warnings };
|
|
3021
|
-
}
|
|
3022
|
-
if (args.structuredFile) {
|
|
3023
|
-
const p = path.resolve(String(args.structuredFile));
|
|
3024
|
-
const s = JSON.parse(fs.readFileSync(p, "utf8"));
|
|
3025
|
-
if (!s || typeof s !== "object") throw rsValidationError("structured_invalid", "structuredFile \u5185\u5BB9\u4E0D\u662F\u5408\u6CD5 JSON \u5BF9\u8C61");
|
|
3026
|
-
if (!String(s.telephone || "").trim() && !String(s.candidateName || "").trim()) {
|
|
3027
|
-
throw rsValidationError("structured_invalid", "\u7ED3\u6784\u5316\u7B80\u5386\u7F3A\u5C11 telephone \u4E0E candidateName");
|
|
3028
|
-
}
|
|
3029
|
-
const normalizedFile = normalizeTextStructured(ctx.cache, s, warnings);
|
|
3030
|
-
normalizeDates(normalizedFile, warnings);
|
|
3031
|
-
return { structured: normalizedFile, textMode: true, warnings };
|
|
3032
|
-
}
|
|
3033
|
-
return { structured: null, textMode: false, warnings };
|
|
3034
|
-
}
|
|
3035
2918
|
async function buildImport(ctx, args) {
|
|
3036
2919
|
const { host, baseUrl, appId, cache } = ctx;
|
|
2920
|
+
mark("build.start");
|
|
3037
2921
|
const objId = objIdOf(cache, "talent_pool");
|
|
3038
2922
|
const formId = formIdOf(cache, "talent_pool");
|
|
3039
2923
|
const fields = cache.fields[objId] || {};
|
|
3040
2924
|
if (!fields.candidate_name || !fields.telephone) throw rsFail("\u73AF\u5883\u7F13\u5B58\u7F3A\u4EBA\u624D\u8868\u5355\u5B57\u6BB5 candidate_name/telephone");
|
|
3041
2925
|
const resumeFieldId = fields.original_resume || "937153853968539861";
|
|
3042
|
-
|
|
3043
|
-
|
|
2926
|
+
if (!args.fileId && !args.resumeFile) throw rsFail("\u7F3A\u5C11\u539F\u4EF6\uFF1A\u8BF7\u4F20 resumeFile\uFF08\u672C\u5730\u7B80\u5386\u8DEF\u5F84\uFF09\u6216 fileId\uFF08\u5DF2\u4E0A\u4F20\u7684\u7B80\u5386\u9644\u4EF6 id\uFF09\u3002\u89E3\u6790\u56FA\u5B9A\u8D70 OCR\uFF0C\u4E0D\u63A5\u53D7\u7ED3\u6784\u5316 JSON \u8F93\u5165");
|
|
2927
|
+
const gateP = checkExtractionGate(host);
|
|
2928
|
+
gateP.catch(() => {
|
|
2929
|
+
});
|
|
3044
2930
|
let fileid = args.fileId ? String(args.fileId) : "";
|
|
3045
2931
|
let fileName = null;
|
|
3046
|
-
if (!fileid
|
|
2932
|
+
if (!fileid) {
|
|
3047
2933
|
const up = await uploadResume(host, baseUrl, path.resolve(String(args.resumeFile)), resumeFieldId, formId);
|
|
3048
2934
|
fileid = up.fileid;
|
|
3049
2935
|
fileName = up.name;
|
|
3050
2936
|
}
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
2937
|
+
await gateP;
|
|
2938
|
+
const reuse = args.parsedResume && typeof args.parsedResume === "object" ? args.parsedResume : null;
|
|
2939
|
+
let structured;
|
|
2940
|
+
if (reuse) {
|
|
2941
|
+
mark("build.\u590D\u7528prepare\u89E3\u6790\u7ED3\u679C");
|
|
2942
|
+
structured = reuse;
|
|
2943
|
+
} else {
|
|
2944
|
+
const cached = loadOcrResult(fileid);
|
|
2945
|
+
if (cached) {
|
|
2946
|
+
mark("build.\u590D\u7528OCR\u7F13\u5B58");
|
|
2947
|
+
structured = cached;
|
|
2948
|
+
} else {
|
|
2949
|
+
structured = await extractResume(host, fileid);
|
|
3055
2950
|
}
|
|
3056
|
-
structured = await extractResume(host, fileid);
|
|
3057
2951
|
}
|
|
2952
|
+
saveOcrResult(fileid, structured);
|
|
3058
2953
|
const schoolTagInfo = args.noSchoolTags ? { candidates: [], detail: [], schools: [] } : deriveSchoolTags(structured);
|
|
3059
2954
|
const tagNames = [...args.tags || []];
|
|
3060
2955
|
const schoolNameSet = new Set((schoolTagInfo.schools || []).map((s) => String(s)));
|
|
@@ -3067,6 +2962,7 @@ async function buildImport(ctx, args) {
|
|
|
3067
2962
|
if (schoolNameSet.has(nm) && !tieredSchoolSet.has(nm)) continue;
|
|
3068
2963
|
tagNames.push(nm);
|
|
3069
2964
|
}
|
|
2965
|
+
mark("build.ocr\u540E-\u6620\u5C04\u524D");
|
|
3070
2966
|
const dataDetails = mapToTalent(fields, structured);
|
|
3071
2967
|
if (fileid) {
|
|
3072
2968
|
dataDetails.push({ formField: { id: resumeFieldId }, dataOptions: [{ optionId: String(fileid), content: fileName || "\u7B80\u5386\u9644\u4EF6", type: "file" }] });
|
|
@@ -3085,8 +2981,12 @@ async function buildImport(ctx, args) {
|
|
|
3085
2981
|
dataDetails.push({ formField: { id: fields.channel }, dataOptions: [{ optionId: String(manualId), content: "\u624B\u52A8\u5F55\u5165" }] });
|
|
3086
2982
|
channelLabel = "\u624B\u52A8\u5F55\u5165\uFF08\u56FA\u5B9A\uFF09";
|
|
3087
2983
|
}
|
|
2984
|
+
mark("build.\u6E20\u9053\u6620\u5C04\u5B8C\u6210");
|
|
2985
|
+
const blacklistP = fields.is_blacklist ? getDsOptions(host, objId, fields.is_blacklist).catch(() => ({})) : Promise.resolve({});
|
|
2986
|
+
const subMetaP = resolveSubTableMeta(ctx).then((v) => ({ ok: true, v }), (e) => ({ ok: false, e }));
|
|
2987
|
+
const mappingP = getTableMapping(host, objId).then((v) => ({ ok: true, v }), (e) => ({ ok: false, e }));
|
|
2988
|
+
const opt = await blacklistP;
|
|
3088
2989
|
if (fields.is_blacklist) {
|
|
3089
|
-
const opt = await getDsOptions(host, objId, fields.is_blacklist).catch(() => ({}));
|
|
3090
2990
|
const noId = opt["\u5426"];
|
|
3091
2991
|
if (noId) dataDetails.push({ formField: { id: fields.is_blacklist }, dataOptions: [{ optionId: String(noId), content: "\u5426" }] });
|
|
3092
2992
|
}
|
|
@@ -3097,10 +2997,13 @@ async function buildImport(ctx, args) {
|
|
|
3097
2997
|
const detailNodes = {};
|
|
3098
2998
|
const unmappedTables = [];
|
|
3099
2999
|
try {
|
|
3100
|
-
|
|
3000
|
+
const metaR = await subMetaP;
|
|
3001
|
+
if (!metaR.ok) throw metaR.e;
|
|
3002
|
+
subMeta = metaR.v;
|
|
3101
3003
|
subBuild = buildSubDetails(structured, subMeta, cache);
|
|
3102
|
-
const
|
|
3103
|
-
|
|
3004
|
+
const mapR = await mappingP;
|
|
3005
|
+
if (!mapR.ok) throw mapR.e;
|
|
3006
|
+
const nodeOf = invertTableMapping(mapR.v);
|
|
3104
3007
|
for (const [dk, rows] of Object.entries(subBuild.byTable)) {
|
|
3105
3008
|
const sub = subMeta[dk];
|
|
3106
3009
|
const node = sub ? nodeOf[String(sub.subFormId)] : null;
|
|
@@ -3115,6 +3018,7 @@ async function buildImport(ctx, args) {
|
|
|
3115
3018
|
subError = e.message;
|
|
3116
3019
|
}
|
|
3117
3020
|
const subRowTotal = Object.values(subBuild.byTable).reduce((n, rows) => n + rows.length, 0);
|
|
3021
|
+
mark("build.\u660E\u7EC6\u88C5\u914D\u5B8C\u6210");
|
|
3118
3022
|
return {
|
|
3119
3023
|
objId,
|
|
3120
3024
|
formId,
|
|
@@ -3122,8 +3026,6 @@ async function buildImport(ctx, args) {
|
|
|
3122
3026
|
fileid,
|
|
3123
3027
|
fileName,
|
|
3124
3028
|
structured,
|
|
3125
|
-
textMode,
|
|
3126
|
-
structuredTextWarnings,
|
|
3127
3029
|
dataDetails,
|
|
3128
3030
|
detailsPayload,
|
|
3129
3031
|
detailNodes,
|
|
@@ -3198,31 +3100,44 @@ function fingerprintMainTable(mainTable) {
|
|
|
3198
3100
|
return copy;
|
|
3199
3101
|
}
|
|
3200
3102
|
var baseInput2 = {
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
fileId: { type: "string", description: "\u5DF2\u4E0A\u4F20\u5230 E10 \u7684\u7B80\u5386\u9644\u4EF6 id\uFF08\u539F\u4EF6\u5199\u8FDB\u9644\u4EF6\u5B57\u6BB5\uFF09" },
|
|
3204
|
-
resumeFile: { type: "string", description: "\u672C\u5730\u7B80\u5386\u6587\u4EF6\u8DEF\u5F84\uFF08\u4E24\u6B65 multipart \u4E0A\u4F20\uFF09" },
|
|
3103
|
+
fileId: { type: "string", description: "\u5DF2\u4E0A\u4F20\u5230 E10 \u7684\u7B80\u5386\u9644\u4EF6 id\uFF08\u539F\u4EF6\u5199\u8FDB\u9644\u4EF6\u5B57\u6BB5\uFF1B\u590D\u8DD1/apply \u590D\u7528\u6B64 id \u53EF\u8DF3\u8FC7\u4E8C\u6B21\u4E0A\u4F20\uFF09" },
|
|
3104
|
+
resumeFile: { type: "string", description: "\u672C\u5730\u7B80\u5386\u6587\u4EF6\u8DEF\u5F84\uFF08\u4E24\u6B65 multipart \u4E0A\u4F20\u540E\u8D70 OCR \u89E3\u6790\uFF09" },
|
|
3205
3105
|
photoFile: { type: "string", description: "\u53EF\u9009\uFF1A\u7528\u6237\u4E3B\u52A8\u63D0\u4F9B\u7684\u5934\u50CF\u56FE\u7247\u672C\u5730\u8DEF\u5F84\u3002\u4E0D\u81EA\u52A8\u4ECE\u7B80\u5386\u63D0\u53D6\uFF1B\u6CA1\u7ED9\u6216\u5199\u5931\u8D25\u90FD\u8DF3\u8FC7\uFF0C\u4E0D\u5F71\u54CD\u5EFA\u6863" },
|
|
3206
3106
|
channel: { type: "string", description: "\u7B80\u5386\u6E20\u9053\uFF08\u987B\u5728\u6570\u636E\u5B57\u5178\u4E2D\u5B58\u5728\uFF1B\u7F3A\u7701\u56FA\u5B9A\u300C\u624B\u52A8\u5F55\u5165\u300D\uFF09" },
|
|
3207
3107
|
tags: { type: "array", items: { type: "string" }, maxItems: 20, description: "\u5E73\u53F0\u6807\u7B7E\u540D\uFF08\u6309\u540D\u547D\u4E2D\u73AF\u5883\u6E05\u5355\uFF0C\u4E0D\u5B58\u5728\u8DF3\u8FC7\uFF1B\u5B66\u6821\u5F52\u5C5E\u81EA\u52A8\u63A8\u5BFC\u53E6\u7B97\uFF09" },
|
|
3208
|
-
useOcr: { type: "boolean", description: "\u663E\u5F0F\u5F00\u542F OCR \u515C\u5E95\u89E3\u6790\uFF08\u95F8\u95E8=checkResumeExtraction\uFF1B\u9ED8\u8BA4\u6C38\u4E0D\u4E0A\u8C03\uFF09" },
|
|
3209
3108
|
noSchoolTags: { type: "boolean", description: "\u5173\u95ED\u5B66\u6821\u5F52\u5C5E\u6807\u7B7E\u81EA\u52A8\u63A8\u5BFC" },
|
|
3210
3109
|
updateTalentId: { type: "string", description: "\u6309\u7B80\u5386\u66F4\u65B0\u5DF2\u6709\u4EBA\u624D\uFF08\u4E3B\u8868\u5168\u91CF\u8986\u76D6+\u660E\u7EC6\u6574\u8868\u8986\u76D6\uFF1B\u5148 prepare \u770B\u5DEE\u5F02\uFF09" }
|
|
3211
3110
|
};
|
|
3212
3111
|
async function prepare2(args, env, opts = {}) {
|
|
3112
|
+
tracePrev = 0;
|
|
3113
|
+
mark("prepare.\u8FDB\u7A0B\u5185\u8D77\u70B9");
|
|
3213
3114
|
const host = env.host;
|
|
3214
3115
|
const session = await host.getSession();
|
|
3215
3116
|
const ctx = { host, baseUrl: session.baseUrl.replace(/\/+$/, ""), appId: "", cache: await env.recruitContext() };
|
|
3216
3117
|
ctx.appId = ctx.cache.appId;
|
|
3118
|
+
mark("prepare.session+recruitContext");
|
|
3119
|
+
const legacy = [
|
|
3120
|
+
args.structured !== void 0 ? "structured" : "",
|
|
3121
|
+
args.structuredFile !== void 0 ? "structuredFile" : "",
|
|
3122
|
+
args.useOcr !== void 0 ? "useOcr" : ""
|
|
3123
|
+
].filter(Boolean);
|
|
3124
|
+
if (legacy.length) {
|
|
3125
|
+
throw rsValidationError(
|
|
3126
|
+
"legacy_channel_removed",
|
|
3127
|
+
"\u89E3\u6790\u53EA\u8D70 OCR\uFF1A\u5DF2\u79FB\u9664 " + legacy.join("/") + " \u901A\u9053\uFF0C\u8BF7\u6539\u4E3A\u53EA\u4F20 resumeFile\uFF08\u672C\u5730\u539F\u4EF6\uFF09\u6216 fileId\uFF08\u5DF2\u4E0A\u4F20\u539F\u4EF6\uFF09\uFF1BOCR \u81EA\u52A8\u6267\u884C\uFF0C\u65E0\u9700\u5F00\u5173"
|
|
3128
|
+
);
|
|
3129
|
+
}
|
|
3217
3130
|
if (!opts.skipPermissionProbe) {
|
|
3218
3131
|
const perm = await probeCreatePermission(ctx.host, objIdOf(ctx.cache, "talent_pool"));
|
|
3219
3132
|
if (perm === "denied") throw rsFail("\u5F53\u524D\u8D26\u53F7\u6CA1\u6709\u300C\u4EBA\u624D\u5E93\u300D\u8868\u5355\u7684\u521B\u5EFA\u6743\u9650\uFF0C\u5DF2\u963B\u65AD\uFF08\u672A\u5199\u5165\u4EFB\u4F55\u6570\u636E\uFF09");
|
|
3220
3133
|
}
|
|
3134
|
+
mark("prepare.\u6743\u9650\u63A2\u6D4B");
|
|
3221
3135
|
const argsT = args;
|
|
3222
|
-
if (!argsT.
|
|
3223
|
-
throw rsValidationError("input_required", "\u9700\u8981
|
|
3136
|
+
if (!argsT.fileId && !argsT.resumeFile) {
|
|
3137
|
+
throw rsValidationError("input_required", "\u9700\u8981 resumeFile\uFF08\u672C\u5730\u7B80\u5386\u8DEF\u5F84\uFF09\u6216 fileId\uFF08\u5DF2\u4E0A\u4F20\u7B80\u5386\u9644\u4EF6 id\uFF09\u4E4B\u4E00\uFF1B\u89E3\u6790\u56FA\u5B9A\u8D70 OCR\uFF0C\u4E0D\u518D\u63A5\u53D7\u7ED3\u6784\u5316 JSON");
|
|
3224
3138
|
}
|
|
3225
3139
|
const built = await buildImport(ctx, argsT);
|
|
3140
|
+
mark("prepare.buildImport \u5B8C\u6210");
|
|
3226
3141
|
if (argsT.updateTalentId) {
|
|
3227
3142
|
const updateTalentId = String(argsT.updateTalentId);
|
|
3228
3143
|
const snapshot = await readTalentSnapshot(ctx, { formId: built.formId, objId: built.objId, fields: built.fields, subMeta: built.subMeta, dataId: updateTalentId });
|
|
@@ -3281,16 +3196,14 @@ async function prepare2(args, env, opts = {}) {
|
|
|
3281
3196
|
// confirm + continuation 时,buildImport 需要的简历来源参数必须能从快照恢复,
|
|
3282
3197
|
// 否则会报 resume_source_required(文档写法跑不通)。
|
|
3283
3198
|
argsSnapshot: {
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
fileId: args.fileId ? String(args.fileId) : void 0,
|
|
3199
|
+
// 同新建路径:prepare 已上传的 fileid 必须回传,避免 apply 二次上传(并防孤儿附件)
|
|
3200
|
+
fileId: (args.fileId ? String(args.fileId) : built.fileid) || void 0,
|
|
3287
3201
|
resumeFile: args.resumeFile ? String(args.resumeFile) : void 0,
|
|
3288
3202
|
photoFile: args.photoFile ? String(args.photoFile) : void 0,
|
|
3203
|
+
parsedResume: snapshotParsedResume(built.structured),
|
|
3289
3204
|
channel: args.channel ? String(args.channel) : void 0,
|
|
3290
3205
|
updateTalentId: args.updateTalentId ? String(args.updateTalentId) : void 0,
|
|
3291
|
-
useOcr: args.useOcr === true,
|
|
3292
3206
|
noSchoolTags: args.noSchoolTags === true,
|
|
3293
|
-
structured: args.structured,
|
|
3294
3207
|
tags: args.tags
|
|
3295
3208
|
}
|
|
3296
3209
|
});
|
|
@@ -3328,10 +3241,12 @@ async function prepare2(args, env, opts = {}) {
|
|
|
3328
3241
|
return { requested: built.tagNames, error: e.message };
|
|
3329
3242
|
}
|
|
3330
3243
|
})();
|
|
3244
|
+
mark("prepare.\u67E5\u91CD\u5EFA\u6863\u5E76\u884C\u524D");
|
|
3331
3245
|
const [dupInfo, tagCheck] = await Promise.all([
|
|
3332
3246
|
findExistingTalents(ctx, { objId: built.objId, formId: built.formId, fields: built.fields, mobile: built.structured.telephone }),
|
|
3333
3247
|
tagCheckTask
|
|
3334
3248
|
]);
|
|
3249
|
+
mark("prepare.\u67E5\u91CD+\u6807\u7B7E\u9884\u68C0");
|
|
3335
3250
|
const summary = {
|
|
3336
3251
|
action: "\u7B80\u5386\u5BFC\u5165\u5EFA\u4EBA\u624D",
|
|
3337
3252
|
resumeFile: built.fileName || "fileid=" + built.fileid,
|
|
@@ -3358,7 +3273,6 @@ async function prepare2(args, env, opts = {}) {
|
|
|
3358
3273
|
subTableNodes: built.detailNodes,
|
|
3359
3274
|
subTableUnmapped: built.unmappedTables.length ? built.unmappedTables : void 0,
|
|
3360
3275
|
subTableError: built.subError || void 0,
|
|
3361
|
-
structuredWarnings: built.structuredTextWarnings.length ? built.structuredTextWarnings : void 0,
|
|
3362
3276
|
duplicate: {
|
|
3363
3277
|
checked: dupInfo.checked,
|
|
3364
3278
|
unique: dupInfo.unique,
|
|
@@ -3384,15 +3298,16 @@ async function prepare2(args, env, opts = {}) {
|
|
|
3384
3298
|
// confirm + continuation 时,buildImport 需要的简历来源参数必须能从快照恢复,
|
|
3385
3299
|
// 否则会报 resume_source_required(文档写法跑不通)。
|
|
3386
3300
|
argsSnapshot: {
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3301
|
+
// 🔴 2026-11-18 修「apply 二次上传」:prepare 已上传拿到 fileid,快照必须带它。
|
|
3302
|
+
// 此前只带用户显式传的 args.fileId(resumeFile 场景为 undefined)→ apply 重新上传同一份
|
|
3303
|
+
// 原件,既多付 0.5~0.6 s/RTT,又在附件库留下孤儿文件(只有最后一份被绑定)。
|
|
3304
|
+
fileId: (args.fileId ? String(args.fileId) : built.fileid) || void 0,
|
|
3390
3305
|
resumeFile: args.resumeFile ? String(args.resumeFile) : void 0,
|
|
3306
|
+
// OCR 解析结果随快照回传:apply 直接复用,不再重复调 resumeExtraction(单份省 2.6~9.5 s)
|
|
3307
|
+
parsedResume: snapshotParsedResume(built.structured),
|
|
3391
3308
|
channel: args.channel ? String(args.channel) : void 0,
|
|
3392
3309
|
updateTalentId: args.updateTalentId ? String(args.updateTalentId) : void 0,
|
|
3393
|
-
useOcr: args.useOcr === true,
|
|
3394
3310
|
noSchoolTags: args.noSchoolTags === true,
|
|
3395
|
-
structured: args.structured,
|
|
3396
3311
|
tags: args.tags
|
|
3397
3312
|
}
|
|
3398
3313
|
});
|
|
@@ -3427,13 +3342,17 @@ async function apply2(args, env) {
|
|
|
3427
3342
|
return applyCore({ ...payload.argsSnapshot || {}, ...args }, env, payload);
|
|
3428
3343
|
}
|
|
3429
3344
|
async function applyCore(args, env, payload) {
|
|
3345
|
+
tracePrev = 0;
|
|
3346
|
+
mark("apply.\u8FDB\u7A0B\u5185\u8D77\u70B9");
|
|
3430
3347
|
restoreDsOptions(payload.enumMaps);
|
|
3431
3348
|
const host = env.host;
|
|
3432
3349
|
const session = await host.getSession();
|
|
3433
3350
|
const ctx = { host, baseUrl: session.baseUrl.replace(/\/+$/, ""), appId: "", cache: await env.recruitContext() };
|
|
3434
3351
|
ctx.appId = ctx.cache.appId;
|
|
3352
|
+
mark("apply.context");
|
|
3435
3353
|
const argsT = args;
|
|
3436
3354
|
const built = await buildImport(ctx, argsT);
|
|
3355
|
+
mark("apply.buildImport \u5B8C\u6210");
|
|
3437
3356
|
if (argsT.updateTalentId) {
|
|
3438
3357
|
const updateTalentId = String(argsT.updateTalentId);
|
|
3439
3358
|
const upMain = toDatasetMainTable(built.dataDetails, built.fields);
|
|
@@ -3518,6 +3437,7 @@ async function applyCore(args, env, payload) {
|
|
|
3518
3437
|
if (!dupInfo.unique && dupInfo.formConflicts.unreadable.length) {
|
|
3519
3438
|
throw rsFail("\u624B\u673A\u53F7\u88AB " + dupInfo.formConflicts.unreadable.length + " \u6761\u5DF2\u5220\u9664\u8BB0\u5F55\u5360\u7528\uFF08\u5E73\u53F0\u552F\u4E00\u6027\u6821\u9A8C\u4ECD\u62E6\u65B0\u5EFA\uFF0Cid=" + dupInfo.formConflicts.unreadable.join(",") + "\uFF09\uFF1A\u8BF7\u5148\u5728\u56DE\u6536\u7AD9\u6E05\u7406\uFF0C\u6216\u6539\u4E3A\u66F4\u65B0\u5DF2\u6709\u4EBA\u624D");
|
|
3520
3439
|
}
|
|
3440
|
+
mark("apply.\u67E5\u91CD\u5B8C\u6210");
|
|
3521
3441
|
const datasetMain = toDatasetMainTable(built.dataDetails, built.fields);
|
|
3522
3442
|
let newId = "";
|
|
3523
3443
|
let writeChannel = "";
|
|
@@ -3538,7 +3458,9 @@ async function applyCore(args, env, payload) {
|
|
|
3538
3458
|
}
|
|
3539
3459
|
}
|
|
3540
3460
|
}
|
|
3461
|
+
mark("apply.saveFormData");
|
|
3541
3462
|
const r2 = await host.request({ path: "/api/recruit/candidate/initTalentBatch?formDataId=" + newId, method: "POST" });
|
|
3463
|
+
mark("apply.initTalentBatch");
|
|
3542
3464
|
const talentId = String(newId);
|
|
3543
3465
|
const avatarRes = await writeAvatarIfProvided(ctx, {
|
|
3544
3466
|
photoFile: argsT.photoFile,
|
|
@@ -3566,6 +3488,7 @@ async function applyCore(args, env, payload) {
|
|
|
3566
3488
|
(e) => ({ ok: false, e })
|
|
3567
3489
|
)
|
|
3568
3490
|
]);
|
|
3491
|
+
mark("apply.\u56DB\u4E8B\u5E76\u884C");
|
|
3569
3492
|
const subTableVerify = verifyRes.ok ? verifyRes.v : { error: verifyRes.e?.message };
|
|
3570
3493
|
let detailsState = "complete";
|
|
3571
3494
|
if (!verifyRes.ok) {
|
|
@@ -3581,6 +3504,7 @@ async function applyCore(args, env, payload) {
|
|
|
3581
3504
|
const saveEsbActions = esbRes.ok ? esbRes.v : { error: esbRes.e?.message };
|
|
3582
3505
|
const labelMatch = labelRes.ok ? labelRes.v : "ERR:" + (labelRes.e?.message || "");
|
|
3583
3506
|
const tagResult = tagRes.ok ? tagRes.v : { applied: [], skipped: built.tagNames, error: tagRes.e?.message };
|
|
3507
|
+
mark("apply.\u6807\u7B7E\u56DE\u8BFB");
|
|
3584
3508
|
const tags = await queryEntityTags(host, talentId).catch(() => []);
|
|
3585
3509
|
const CORE_VERIFY_KEYS = ["candidate_name", "telephone", "email"];
|
|
3586
3510
|
const submittedKeys = Object.keys(built.fields).filter((k) => built.dataDetails.some((d) => String(d?.formField?.id) === String(built.fields[k])));
|
|
@@ -3609,13 +3533,15 @@ async function applyCore(args, env, payload) {
|
|
|
3609
3533
|
// checked=false 表示环境缓存无该字段定义、未进回查清单,不代表绑定失败
|
|
3610
3534
|
checked: attachFieldChecked,
|
|
3611
3535
|
bound: attachFieldChecked ? !attachMismatch : null,
|
|
3612
|
-
detail: attachMismatch ? "\u9644\u4EF6\u5B57\u6BB5\u56DE\u67E5\u4E0D\u4E00\u81F4\uFF1A\u671F\u671B\u975E\u7A7A\uFF0C\u5B9E\u9645 " + attachMismatch.actual : built.fileid ? attachFieldChecked ? "\u9644\u4EF6\u5B57\u6BB5\u5DF2\u56DE\u67E5\u786E\u8BA4\u975E\u7A7A" : "\u539F\u4EF6\u5DF2\u4E0A\u4F20\uFF08fileId \u89C1\u4E0A\uFF09\uFF0C\u4F46\u73AF\u5883\u7F13\u5B58\u65E0 original_resume \u5B57\u6BB5\u5B9A\u4E49\uFF0C\u672A\u7EB3\u5165\u56DE\u67E5" : "\
|
|
3536
|
+
detail: attachMismatch ? "\u9644\u4EF6\u5B57\u6BB5\u56DE\u67E5\u4E0D\u4E00\u81F4\uFF1A\u671F\u671B\u975E\u7A7A\uFF0C\u5B9E\u9645 " + attachMismatch.actual : built.fileid ? attachFieldChecked ? "\u9644\u4EF6\u5B57\u6BB5\u5DF2\u56DE\u67E5\u786E\u8BA4\u975E\u7A7A" : "\u539F\u4EF6\u5DF2\u4E0A\u4F20\uFF08fileId \u89C1\u4E0A\uFF09\uFF0C\u4F46\u73AF\u5883\u7F13\u5B58\u65E0 original_resume \u5B57\u6BB5\u5B9A\u4E49\uFF0C\u672A\u7EB3\u5165\u56DE\u67E5" : "\u539F\u4EF6\u4EE5 fileId \u590D\u7528\uFF08\u672C\u673A\u672A\u91CD\u65B0\u4E0A\u4F20\uFF09"
|
|
3613
3537
|
};
|
|
3614
3538
|
if (attachMismatch) {
|
|
3615
3539
|
writeWarnings.push("\u7B80\u5386\u9644\u4EF6\u672A\u7ED1\u5B9A\u5230\u4EBA\u624D\u8BB0\u5F55\uFF08original_resume \u56DE\u67E5\u4E3A\u7A7A\uFF09\uFF1A\u539F\u4EF6\u5DF2\u4E0A\u4F20\u4F46\u672A\u5199\u5165\u9644\u4EF6\u5B57\u6BB5\uFF0C\u8BF7\u5728\u4EBA\u624D\u5361\u7247\u9875\u624B\u5DE5\u8865\u6302\uFF0C\u6216\u8D70 updateTalentId \u91CD\u4F20");
|
|
3616
3540
|
}
|
|
3617
3541
|
const result = detailsState === "complete" && !verification.mismatches.length ? "success" : "partial";
|
|
3542
|
+
mark("apply.\u56DE\u67E5\u5B8C\u6210");
|
|
3618
3543
|
const talentCardUrl = await resolveTalentCardUrl(ctx, talentId);
|
|
3544
|
+
mark("apply.\u5361\u7247/\u5217\u8868\u94FE\u63A5");
|
|
3619
3545
|
const talentListLocateUrl = await resolveTalentListLocateUrl(ctx, talentId);
|
|
3620
3546
|
return rsSuccess("recruit-stage.resume.import.apply", {
|
|
3621
3547
|
mode: "apply",
|
|
@@ -3660,15 +3586,43 @@ async function applyCore(args, env, payload) {
|
|
|
3660
3586
|
});
|
|
3661
3587
|
}
|
|
3662
3588
|
var IMPORT_BATCH_MAX = 50;
|
|
3589
|
+
async function mapLimit(list, limit, fn) {
|
|
3590
|
+
const results = new Array(list.length);
|
|
3591
|
+
const width = Math.max(1, Math.min(limit, list.length));
|
|
3592
|
+
let cursor = 0;
|
|
3593
|
+
await Promise.all(Array.from({ length: width }, async () => {
|
|
3594
|
+
while (true) {
|
|
3595
|
+
const index = cursor++;
|
|
3596
|
+
if (index >= list.length) return;
|
|
3597
|
+
results[index] = await fn(list[index], index);
|
|
3598
|
+
}
|
|
3599
|
+
}));
|
|
3600
|
+
return results;
|
|
3601
|
+
}
|
|
3602
|
+
function batchConcurrency(stage) {
|
|
3603
|
+
const raw = stage === "prepare" ? process.env.E10_BATCH_PREPARE_CONCURRENCY ?? "5" : process.env.E10_BATCH_APPLY_CONCURRENCY ?? "2";
|
|
3604
|
+
const n = Number(raw);
|
|
3605
|
+
return Number.isFinite(n) && n >= 1 ? Math.min(5, Math.floor(n)) : stage === "prepare" ? 5 : 2;
|
|
3606
|
+
}
|
|
3663
3607
|
async function batchPrepare(args, env) {
|
|
3608
|
+
const legacyBatch = [
|
|
3609
|
+
args.structuredDir !== void 0 ? "structuredDir" : "",
|
|
3610
|
+
args.useOcr !== void 0 ? "useOcr" : "",
|
|
3611
|
+
...(Array.isArray(args.items) ? args.items : []).map((x, i) => x && (x.structured !== void 0 || x.structuredFile !== void 0) ? `items[${i}].${x.structured !== void 0 ? "structured" : "structuredFile"}` : "").filter(Boolean)
|
|
3612
|
+
].filter(Boolean);
|
|
3613
|
+
if (legacyBatch.length) {
|
|
3614
|
+
throw rsValidationError(
|
|
3615
|
+
"legacy_channel_removed",
|
|
3616
|
+
"\u6279\u91CF\u89E3\u6790\u540C\u6837\u53EA\u8D70 OCR\uFF1A\u5DF2\u79FB\u9664 " + legacyBatch.join("/") + "\uFF0C\u8BF7\u6539\u4E3A items:[{file}] \u6216 source\uFF08\u6587\u4EF6\u5939/.zip\uFF09\uFF0C\u6BCF\u9879\u5FC5\u987B\u662F\u7B80\u5386\u539F\u4EF6"
|
|
3617
|
+
);
|
|
3618
|
+
}
|
|
3664
3619
|
const explicit = Array.isArray(args.items) ? args.items : null;
|
|
3665
3620
|
const scan = !explicit && args.source ? scanResumeSource(String(args.source)) : null;
|
|
3666
3621
|
if (!explicit && !scan) {
|
|
3667
|
-
throw rsValidationError("source_required", "\u9700\u8981 source\uFF08\u6587\u4EF6\u5939\u6216 .zip \u8DEF\u5F84\uFF09\u6216 items\uFF08[{file,
|
|
3622
|
+
throw rsValidationError("source_required", "\u9700\u8981 source\uFF08\u6587\u4EF6\u5939\u6216 .zip \u8DEF\u5F84\uFF09\u6216 items\uFF08[{file, photoFile?}]\uFF09\u4E4B\u4E00");
|
|
3668
3623
|
}
|
|
3669
|
-
const structuredDir = args.structuredDir ? String(args.structuredDir) : void 0;
|
|
3670
3624
|
const shared = {};
|
|
3671
|
-
for (const k of ["channel", "
|
|
3625
|
+
for (const k of ["channel", "noSchoolTags"]) if (args[k] !== void 0) shared[k] = args[k];
|
|
3672
3626
|
if (Array.isArray(args.tags)) shared.tags = args.tags;
|
|
3673
3627
|
const entries = (explicit || scan.files).map((x, i) => {
|
|
3674
3628
|
if (explicit) {
|
|
@@ -3676,12 +3630,10 @@ async function batchPrepare(args, env) {
|
|
|
3676
3630
|
return {
|
|
3677
3631
|
file,
|
|
3678
3632
|
name: file ? path.basename(file) : `\u7B2C${i + 1}\u9879`,
|
|
3679
|
-
structured: x?.structured,
|
|
3680
|
-
structuredFile: x?.structuredFile,
|
|
3681
3633
|
photoFile: x?.photoFile ? path.resolve(String(x.photoFile)) : void 0
|
|
3682
3634
|
};
|
|
3683
3635
|
}
|
|
3684
|
-
return { file: x.path, name: x.name
|
|
3636
|
+
return { file: x.path, name: x.name };
|
|
3685
3637
|
});
|
|
3686
3638
|
if (entries.length > IMPORT_BATCH_MAX) {
|
|
3687
3639
|
throw rsValidationError("batch_too_many", `\u4E00\u6B21\u6700\u591A ${IMPORT_BATCH_MAX} \u4EFD\uFF08\u5F53\u524D ${entries.length} \u4EFD\uFF09\uFF1B\u8BF7\u5206\u6279\u6267\u884C`);
|
|
@@ -3689,65 +3641,63 @@ async function batchPrepare(args, env) {
|
|
|
3689
3641
|
if (!entries.length) {
|
|
3690
3642
|
throw rsValidationError("no_resume_files", "\u6CA1\u6709\u627E\u5230\u7B80\u5386\u6587\u4EF6\uFF08\u652F\u6301 pdf/doc/docx/rtf/txt/wps\uFF1B\u76EE\u5F55\u6700\u591A\u5411\u4E0B 4 \u5C42\uFF09");
|
|
3691
3643
|
}
|
|
3692
|
-
const
|
|
3693
|
-
const ready = [];
|
|
3694
|
-
for (let i = 0; i < entries.length; i++) {
|
|
3695
|
-
const e = entries[i];
|
|
3644
|
+
const prepared = await mapLimit(entries, batchConcurrency("prepare"), async (e, i) => {
|
|
3696
3645
|
const row = { index: i + 1, file: e.name, path: e.file || void 0 };
|
|
3697
3646
|
try {
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
if (hit) structuredFile = hit;
|
|
3703
|
-
}
|
|
3704
|
-
if (!structured && !structuredFile && !shared.useOcr) {
|
|
3705
|
-
row.status = "needs_parse";
|
|
3706
|
-
row.message = "\u7F3A\u5C11\u7ED3\u6784\u5316\u6570\u636E\uFF1A\u8BF7\u7531\u5927\u6A21\u578B\u89E3\u6790\u540E\u4EE5 items[].structured\uFF08\u6216\u540C\u540D .json\uFF09\u63D0\u4F9B\uFF1B\u626B\u63CF\u4EF6\u53EF\u663E\u5F0F useOcr:true";
|
|
3707
|
-
items.push(row);
|
|
3708
|
-
continue;
|
|
3647
|
+
if (!e.file) {
|
|
3648
|
+
row.status = "failed";
|
|
3649
|
+
row.message = "\u8BE5\u9879\u6CA1\u6709\u7B80\u5386\u6587\u4EF6\u8DEF\u5F84\uFF08items[] \u6BCF\u9879\u5FC5\u987B\u6709 file\uFF09";
|
|
3650
|
+
return { row };
|
|
3709
3651
|
}
|
|
3710
|
-
const r = await prepare2({ ...shared, resumeFile: e.file
|
|
3652
|
+
const r = await prepare2({ ...shared, resumeFile: e.file, photoFile: e.photoFile }, env, { skipPermissionProbe: i > 0 });
|
|
3711
3653
|
const d = r.data || {};
|
|
3712
3654
|
const meta = r.meta || {};
|
|
3713
3655
|
const dup = d.duplicate || {};
|
|
3714
3656
|
const blocked = dup.unique === false;
|
|
3715
3657
|
row.name = d.parsed?.name;
|
|
3716
3658
|
row.mobile = d.parsed?.mobile;
|
|
3717
|
-
row.hasStructured = !!(structured || structuredFile);
|
|
3718
3659
|
row.duplicateNote = dup.note;
|
|
3719
3660
|
if (blocked) {
|
|
3720
3661
|
row.status = "blocked";
|
|
3721
3662
|
row.message = "\u67E5\u91CD\u672A\u901A\u8FC7\uFF1A" + (dup.note || "\u5DF2\u5B58\u5728\u540C\u624B\u673A\u53F7\u4EBA\u624D");
|
|
3722
|
-
|
|
3723
|
-
continue;
|
|
3663
|
+
return { row };
|
|
3724
3664
|
}
|
|
3725
3665
|
row.status = "ready";
|
|
3726
|
-
|
|
3727
|
-
|
|
3666
|
+
return {
|
|
3667
|
+
row,
|
|
3668
|
+
readyItem: {
|
|
3669
|
+
index: i + 1,
|
|
3670
|
+
label: row.name || e.name,
|
|
3671
|
+
file: e.file,
|
|
3672
|
+
// 手机号带上(apply 侧同号串行的键;prepare 已解析出,缺失则按索引各自独立)
|
|
3673
|
+
mobile: row.mobile || "",
|
|
3674
|
+
args: { ...shared, resumeFile: e.file, fileId: d.resumeFileId, photoFile: e.photoFile },
|
|
3675
|
+
fingerprint: String(meta.fingerprint || "")
|
|
3676
|
+
}
|
|
3677
|
+
};
|
|
3728
3678
|
} catch (err) {
|
|
3729
3679
|
row.status = "failed";
|
|
3730
3680
|
row.message = err?.message || "prepare \u5931\u8D25";
|
|
3731
|
-
|
|
3681
|
+
return { row };
|
|
3732
3682
|
}
|
|
3733
|
-
}
|
|
3683
|
+
});
|
|
3684
|
+
const items = prepared.map((x) => x.row);
|
|
3685
|
+
const ready = prepared.filter((x) => x.readyItem).map((x) => x.readyItem);
|
|
3734
3686
|
if (!ready.length) {
|
|
3735
3687
|
return rsSuccess("recruit-stage.resume.import.batch.prepare", {
|
|
3736
3688
|
mode: "batch-prepare",
|
|
3737
3689
|
total: items.length,
|
|
3738
3690
|
ready: 0,
|
|
3739
3691
|
blocked: items.filter((x) => x.status === "blocked").length,
|
|
3740
|
-
needsParse: items.filter((x) => x.status === "needs_parse").length,
|
|
3741
3692
|
failed: items.filter((x) => x.status === "failed").length,
|
|
3742
3693
|
scanned: scan ? { root: scan.root, files: scan.files.length, warnings: scan.warnings } : void 0,
|
|
3743
3694
|
items,
|
|
3744
|
-
hint: "\u6CA1\u6709\u53EF\u6267\u884C\u9879\uFF0C\u9010\u6761\u770B items[].message\uFF08\u5E38\u89C1\uFF1A\
|
|
3695
|
+
hint: "\u6CA1\u6709\u53EF\u6267\u884C\u9879\uFF0C\u9010\u6761\u770B items[].message\uFF08\u5E38\u89C1\uFF1A\u67E5\u91CD\u547D\u4E2D\u3001\u683C\u5F0F\u4E0D\u652F\u6301\u3001\u73AF\u5883\u672A\u5F00\u542F\u7B80\u5386\u62BD\u53D6\uFF09",
|
|
3745
3696
|
// 🔴 2026-11-07:本 op 此前无 preview。文件清单可能很大,preview 只保留「文件 + 状态 + 原因」。
|
|
3746
3697
|
preview: {
|
|
3747
3698
|
action: "\u6279\u91CF\u7B80\u5386\u5BFC\u5165 \u2014 \u65E0\u53EF\u6267\u884C\u9879",
|
|
3748
3699
|
total: items.length,
|
|
3749
3700
|
blocked: items.filter((x) => x.status === "blocked").length,
|
|
3750
|
-
needsParse: items.filter((x) => x.status === "needs_parse").length,
|
|
3751
3701
|
failed: items.filter((x) => x.status === "failed").length,
|
|
3752
3702
|
reasons: items.map((x) => `${x.file}\uFF1A${x.message || x.status}`)
|
|
3753
3703
|
}
|
|
@@ -3762,26 +3712,23 @@ async function batchPrepare(args, env) {
|
|
|
3762
3712
|
batchFile: store.file,
|
|
3763
3713
|
batchFingerprint: store.fingerprint,
|
|
3764
3714
|
// 准备阶段已被查重拦截的份数:apply 汇总里要如实报「跳过」,不能只报成功/失败
|
|
3765
|
-
blockedAtPrepare: items.filter((x) => x.status === "blocked").length
|
|
3766
|
-
needsParseAtPrepare: items.filter((x) => x.status === "needs_parse").length
|
|
3715
|
+
blockedAtPrepare: items.filter((x) => x.status === "blocked").length
|
|
3767
3716
|
});
|
|
3768
3717
|
return rsSuccess("recruit-stage.resume.import.batch.prepare", {
|
|
3769
3718
|
mode: "batch-prepare",
|
|
3770
3719
|
total: items.length,
|
|
3771
3720
|
ready: ready.length,
|
|
3772
3721
|
blocked: items.filter((x) => x.status === "blocked").length,
|
|
3773
|
-
needsParse: items.filter((x) => x.status === "needs_parse").length,
|
|
3774
3722
|
failed: items.filter((x) => x.status === "failed").length,
|
|
3775
3723
|
scanned: scan ? { root: scan.root, files: scan.files.length, warnings: scan.warnings } : void 0,
|
|
3776
3724
|
items,
|
|
3777
3725
|
note: "\u786E\u8BA4\u540E\u5E26 confirm:true \u4E0E meta.continuation \u8C03 batch.apply\uFF1B\u9010\u4EFD\u5EFA\u6863\uFF0C\u53EF\u80FD\u662F partial",
|
|
3778
|
-
// 🔴 2026-11-07:本 op 此前无 preview。preview 只列「文件 +
|
|
3726
|
+
// 🔴 2026-11-07:本 op 此前无 preview。preview 只列「文件 + 状态」。
|
|
3779
3727
|
preview: {
|
|
3780
3728
|
action: "\u6279\u91CF\u7B80\u5386\u5BFC\u5165\uFF08\u9010\u4EFD\u5EFA\u6863\uFF0C\u7ED3\u679C\u53EF\u80FD partial\uFF09",
|
|
3781
3729
|
total: items.length,
|
|
3782
3730
|
ready: ready.length,
|
|
3783
3731
|
blocked: items.filter((x) => x.status === "blocked").length,
|
|
3784
|
-
needsParse: items.filter((x) => x.status === "needs_parse").length,
|
|
3785
3732
|
failed: items.filter((x) => x.status === "failed").length,
|
|
3786
3733
|
files: items.map((x) => `${x.file} \u2014 ${x.status}${x.message ? "\uFF1A" + x.message : ""}`),
|
|
3787
3734
|
scanned: scan ? { root: scan.root, files: scan.files.length, warnings: scan.warnings } : void 0
|
|
@@ -3800,13 +3747,21 @@ async function batchApply(args, env) {
|
|
|
3800
3747
|
const batch = await env.continuation.verify(String(args.continuation), "recruit-stage.resume.import.batch.apply");
|
|
3801
3748
|
const items = loadBatchItems(batch.batchFile, batch.batchFingerprint);
|
|
3802
3749
|
if (!items.length) throw rsValidationError("batch_empty", "continuation \u4E2D\u6CA1\u6709\u53EF\u6267\u884C\u7684\u7B80\u5386");
|
|
3803
|
-
const results =
|
|
3804
|
-
|
|
3750
|
+
const results = new Array(items.length);
|
|
3751
|
+
const phoneTail = /* @__PURE__ */ new Map();
|
|
3752
|
+
await mapLimit(items, batchConcurrency("apply"), async (it, i) => {
|
|
3753
|
+
const key = String(it?.mobile ?? it?.args?.mobile ?? it?.args?.telephone ?? "") || `#${it?.index ?? i}`;
|
|
3754
|
+
const prev = phoneTail.get(key) ?? Promise.resolve();
|
|
3755
|
+
const lock = { release: null };
|
|
3756
|
+
phoneTail.set(key, prev.then(() => new Promise((r) => {
|
|
3757
|
+
lock.release = r;
|
|
3758
|
+
})));
|
|
3759
|
+
await prev;
|
|
3805
3760
|
try {
|
|
3806
3761
|
const r = await applyCore({ ...it.args || {}, confirm: true }, env, { fingerprint: it.fingerprint, enumMaps: batch.enumMaps });
|
|
3807
3762
|
const d = r.data || {};
|
|
3808
3763
|
const isDup = d.result === "duplicate";
|
|
3809
|
-
results
|
|
3764
|
+
results[i] = {
|
|
3810
3765
|
index: it.index,
|
|
3811
3766
|
file: path.basename(String(it.file || "")),
|
|
3812
3767
|
name: it.label,
|
|
@@ -3816,11 +3771,13 @@ async function batchApply(args, env) {
|
|
|
3816
3771
|
viewLink: d.viewLink,
|
|
3817
3772
|
message: isDup ? d.message || "\u624B\u673A\u53F7\u5DF2\u5B58\u5728\uFF0C\u5DF2\u8DF3\u8FC7\uFF08\u672A\u5199\u5165\uFF09" : void 0,
|
|
3818
3773
|
warnings: d.verifyWarnings && d.verifyWarnings.length ? d.verifyWarnings : void 0
|
|
3819
|
-
}
|
|
3774
|
+
};
|
|
3820
3775
|
} catch (e) {
|
|
3821
|
-
results
|
|
3776
|
+
results[i] = { index: it.index, file: path.basename(String(it.file || "")), name: it.label, status: "failed", message: e?.message || "\u6267\u884C\u5931\u8D25" };
|
|
3777
|
+
} finally {
|
|
3778
|
+
lock.release?.();
|
|
3822
3779
|
}
|
|
3823
|
-
}
|
|
3780
|
+
});
|
|
3824
3781
|
const ok = results.filter((x) => x.status === "success").length;
|
|
3825
3782
|
const partial = results.filter((x) => x.status === "partial").length;
|
|
3826
3783
|
const failed = results.filter((x) => x.status === "failed").length;
|
|
@@ -3877,17 +3834,15 @@ var resumeImportOperations = [
|
|
|
3877
3834
|
resource: "recruit.resume",
|
|
3878
3835
|
method: "prepare",
|
|
3879
3836
|
action: "resume.import.batch.prepare",
|
|
3880
|
-
summary: "\u6279\u91CF\u7B80\u5386\u5BFC\u5165\u786E\u8BA4\u6458\u8981\uFF1A\u626B\u63CF\u6587\u4EF6\u5939\u6216 zip\u3001\u9010\u4EFD\u4E0A\u4F20/\u67E5\u91CD/\u5B57\u6BB5\u6620\u5C04\uFF0C\u8F93\u51FA\u53EF\u6267\u884C/\u67E5\u91CD\u62E6\u622A/\
|
|
3837
|
+
summary: "\u6279\u91CF\u7B80\u5386\u5BFC\u5165\u786E\u8BA4\u6458\u8981\uFF1A\u626B\u63CF\u6587\u4EF6\u5939\u6216 zip\u3001\u9010\u4EFD\u4E0A\u4F20/OCR \u89E3\u6790/\u67E5\u91CD/\u5B57\u6BB5\u6620\u5C04\uFF0C\u8F93\u51FA\u53EF\u6267\u884C/\u67E5\u91CD\u62E6\u622A/\u5931\u8D25\u6E05\u5355\uFF08\u4E0D\u5EFA\u6863\uFF09\uFF1B\u4E00\u6B21\u6700\u591A 50 \u4EFD",
|
|
3881
3838
|
capability: "recruit.resume.import",
|
|
3882
3839
|
risk: "write",
|
|
3883
3840
|
requiresConfirmation: true,
|
|
3884
3841
|
inputSchema: schemaOf({
|
|
3885
3842
|
source: { type: "string", description: "\u7B80\u5386\u6587\u4EF6\u5939\u6216 .zip \u5305\u8DEF\u5F84\uFF08\u4E0E items \u4E8C\u9009\u4E00\uFF09" },
|
|
3886
|
-
items: { type: "array", description: "\u663E\u5F0F\u6E05\u5355 [{file,
|
|
3887
|
-
structuredDir: { type: "string", description: "\u7ED3\u6784\u5316 JSON \u76EE\u5F55\uFF08\u6309\u540C\u540D .json \u81EA\u52A8\u5339\u914D\uFF0C\u53EF\u9009\uFF09" },
|
|
3843
|
+
items: { type: "array", description: "\u663E\u5F0F\u6E05\u5355 [{file, photoFile?}]\uFF0C\u4E0E source \u4E8C\u9009\u4E00\uFF1B\u6BCF\u9879\u5FC5\u987B\u662F\u7B80\u5386\u539F\u4EF6\u8DEF\u5F84\uFF08\u89E3\u6790\u56FA\u5B9A\u8D70 OCR\uFF09", items: { type: "object" } },
|
|
3888
3844
|
tags: { type: "array", description: "\u7EDF\u4E00\u8FFD\u52A0\u7684\u6807\u7B7E\u540D", items: { type: "string" } },
|
|
3889
3845
|
channel: { type: "string", description: "\u6E20\u9053\uFF08\u53EF\u9009\uFF09" },
|
|
3890
|
-
useOcr: { type: "boolean", description: "\u663E\u5F0F\u5F00\u542F OCR \u515C\u5E95\u89E3\u6790\uFF08\u95F8\u95E8=checkResumeExtraction\uFF09" },
|
|
3891
3846
|
noSchoolTags: { type: "boolean", description: "\u4E0D\u81EA\u52A8\u63A8\u5BFC\u5B66\u6821\u5F52\u5C5E\u6807\u7B7E" }
|
|
3892
3847
|
}, {}),
|
|
3893
3848
|
handler: batchPrepare
|
|
@@ -5201,6 +5156,7 @@ var TYPES = {
|
|
|
5201
5156
|
interview: { listKey: "interview", formType: "interview_plan", title: "\u9762\u8BD5\u7BA1\u7406", menuNames: ["\u9762\u8BD5\u7BA1\u7406", "\u9762\u8BD5\u5B89\u6392\u5217\u8868", "\u9762\u8BD5\u5B89\u6392"] },
|
|
5202
5157
|
candidate: { listKey: "candidate", formType: "candidate_manage", title: "\u5E94\u8058\u8005", menuNames: ["\u5E94\u8058\u8005", "\u5E94\u8058\u7BA1\u7406", "\u5019\u9009\u4EBA", "\u5E94\u8058\u6279\u6B21"] }
|
|
5203
5158
|
};
|
|
5159
|
+
var FEEDBACK_TODO_MENU_NAMES = ["\u6211\u7684\u9762\u8BD5", "\u6211\u7684\u9762\u8BD5\u5B89\u6392", "\u6211\u53C2\u4E0E\u7684\u9762\u8BD5"];
|
|
5204
5160
|
var DISPLAY_ALIASES = {
|
|
5205
5161
|
candidate_name: ["talent_id", "name"],
|
|
5206
5162
|
position_name: ["position_manage_id", "position"],
|
|
@@ -5254,15 +5210,29 @@ async function runList(env, args, feedbackTodoMode) {
|
|
|
5254
5210
|
if (feedbackTodoMode) {
|
|
5255
5211
|
args.all = true;
|
|
5256
5212
|
}
|
|
5257
|
-
const
|
|
5213
|
+
const formObjId = cache.forms[t.formType]?.objId;
|
|
5214
|
+
const fieldMap = formObjId && cache.fields[formObjId] || {};
|
|
5215
|
+
const feedbackUser = feedbackTodoMode ? await resolveCurrentUser(host) : null;
|
|
5216
|
+
const statusFieldId = String(fieldMap.union_status || "");
|
|
5217
|
+
const interviewerFieldId = String(fieldMap.interviewer || "");
|
|
5218
|
+
const optionMapOf = (fieldId) => {
|
|
5219
|
+
if (!fieldId) return {};
|
|
5220
|
+
const byObj = cache.field_options?.[formObjId];
|
|
5221
|
+
const fromFieldOptions = byObj?.[fieldId];
|
|
5222
|
+
if (fromFieldOptions && typeof fromFieldOptions === "object") return fromFieldOptions;
|
|
5223
|
+
const legacy = cache.options?.[formObjId]?.[fieldId];
|
|
5224
|
+
return legacy && typeof legacy === "object" ? legacy : {};
|
|
5225
|
+
};
|
|
5226
|
+
const pendingOptionId = statusFieldId ? Object.entries(optionMapOf(statusFieldId)).find(([, cn]) => String(cn).trim() === "\u5F85\u53CD\u9988")?.[0] || "" : "";
|
|
5227
|
+
const serverFilterReady = !!(feedbackTodoMode && statusFieldId && pendingOptionId && interviewerFieldId && feedbackUser?.id);
|
|
5228
|
+
const findByMenu = (names) => (cache.lists?.all_search || []).find((m) => m.listId && names.some((n) => (m.menuName || "").trim() === n)) || (cache.lists?.all_search || []).find((m) => m.listId && names.some((n) => (m.menuName || "").includes(n)));
|
|
5229
|
+
const listParam = (feedbackTodoMode && !serverFilterReady ? findByMenu(FEEDBACK_TODO_MENU_NAMES) : null) || cache.lists[t.listKey] || findByMenu(t.menuNames);
|
|
5258
5230
|
if (!listParam?.listId) {
|
|
5259
5231
|
throw rsFail("\u5F53\u524D\u73AF\u5883\u672A\u542F\u7528\u300C" + t.title + "\u300D\u529F\u80FD\uFF08\u672A\u627E\u5230\u5BF9\u5E94\u83DC\u5355/\u5217\u8868\u53C2\u6570\uFF0C\u6309\u80FD\u529B\u63A2\u6D4B\u62E6\u622A\uFF09");
|
|
5260
5232
|
}
|
|
5261
5233
|
const listId = listParam.listId;
|
|
5262
5234
|
const cusMenuId = listParam.cusMenuId;
|
|
5263
5235
|
const menuName = listParam.menuName || t.title;
|
|
5264
|
-
const formObjId = cache.forms[t.formType]?.objId;
|
|
5265
|
-
const fieldMap = formObjId && cache.fields[formObjId] || {};
|
|
5266
5236
|
const commonSearchFields = {};
|
|
5267
5237
|
const appliedFilters = [];
|
|
5268
5238
|
for (const [argKey, def] of Object.entries(FILTER_ARGS)) {
|
|
@@ -5270,10 +5240,19 @@ async function runList(env, args, feedbackTodoMode) {
|
|
|
5270
5240
|
if (!val) continue;
|
|
5271
5241
|
const fieldId = fieldMap[def.dataKey];
|
|
5272
5242
|
if (!fieldId) continue;
|
|
5273
|
-
const
|
|
5274
|
-
commonSearchFields[
|
|
5243
|
+
const mark2 = "field_" + fieldId;
|
|
5244
|
+
commonSearchFields[mark2] = [{ [mark2]: String(val), [mark2 + "_condition_type"]: "like" }];
|
|
5275
5245
|
appliedFilters.push(def.label);
|
|
5276
5246
|
}
|
|
5247
|
+
let serverFilterApplied = false;
|
|
5248
|
+
if (serverFilterReady) {
|
|
5249
|
+
const stMark = "field_" + statusFieldId;
|
|
5250
|
+
commonSearchFields[stMark] = [{ [stMark]: [pendingOptionId], [stMark + "_condition_type"]: "in" }];
|
|
5251
|
+
const ivMark = "field_" + interviewerFieldId;
|
|
5252
|
+
commonSearchFields[ivMark] = [{ [ivMark]: [String(feedbackUser?.id)], [ivMark + "_condition_type"]: "in" }];
|
|
5253
|
+
appliedFilters.push("\u5F85\u53CD\u9988\uFF08\u670D\u52A1\u7AEF in\uFF09", "\u9762\u8BD5\u5B98=\u6211\uFF08\u670D\u52A1\u7AEF in\uFF09");
|
|
5254
|
+
serverFilterApplied = true;
|
|
5255
|
+
}
|
|
5277
5256
|
const baseBody = {
|
|
5278
5257
|
current,
|
|
5279
5258
|
pageSize,
|
|
@@ -5300,35 +5279,56 @@ async function runList(env, args, feedbackTodoMode) {
|
|
|
5300
5279
|
let hasDisplay = false;
|
|
5301
5280
|
let cntTotal = null;
|
|
5302
5281
|
let lastGot = 0;
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5282
|
+
const PAGE_CONCURRENCY = 6;
|
|
5283
|
+
let countFetched = false;
|
|
5284
|
+
for (let start = 0; start < wantPages; start += PAGE_CONCURRENCY) {
|
|
5285
|
+
const end = Math.min(start + PAGE_CONCURRENCY, wantPages);
|
|
5286
|
+
const idxs = [];
|
|
5287
|
+
for (let i = start; i < end; i++) idxs.push(i);
|
|
5288
|
+
const needCount = !countFetched;
|
|
5289
|
+
if (needCount) countFetched = true;
|
|
5290
|
+
const countPromise = needCount ? (() => {
|
|
5291
|
+
const cntBody = { ...baseBody };
|
|
5292
|
+
delete cntBody.current;
|
|
5293
|
+
delete cntBody.pageSize;
|
|
5294
|
+
return host.request({
|
|
5315
5295
|
path: "/api/ebuilder/form/list/getListDataCount?passid=" + formObjId + "&cid=" + formObjId,
|
|
5316
5296
|
body: cntBody,
|
|
5317
5297
|
headers: extra
|
|
5318
|
-
}).catch(() => null)
|
|
5298
|
+
}).catch(() => null);
|
|
5299
|
+
})() : Promise.resolve(null);
|
|
5300
|
+
const [c, ...pageResps] = await Promise.all([
|
|
5301
|
+
countPromise,
|
|
5302
|
+
...idxs.map((i) => host.request({
|
|
5303
|
+
path: "/api/ebuilder/form/list/getListDatas?passid=" + formObjId + "&cid=" + formObjId,
|
|
5304
|
+
body: { ...baseBody, current: current + i },
|
|
5305
|
+
headers: extra
|
|
5306
|
+
}))
|
|
5319
5307
|
]);
|
|
5320
5308
|
if (c && typeof c?.data?.total === "number") cntTotal = c.data.total;
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5309
|
+
let stop = false;
|
|
5310
|
+
for (let k = 0; k < idxs.length; k++) {
|
|
5311
|
+
const i = idxs[k];
|
|
5312
|
+
const resp = pageResps[k];
|
|
5313
|
+
const rRaw = resp?.data?.data || [];
|
|
5314
|
+
const rDisp = resp?.data?.displayData;
|
|
5315
|
+
if (Array.isArray(rDisp) && rDisp.length) {
|
|
5316
|
+
hasDisplay = true;
|
|
5317
|
+
dispRows.push(...rDisp);
|
|
5318
|
+
}
|
|
5319
|
+
rawRows.push(...rRaw);
|
|
5320
|
+
const got = Array.isArray(rDisp) && rDisp.length ? rDisp.length : rRaw.length;
|
|
5321
|
+
lastGot = got;
|
|
5322
|
+
if (got < pageSize) {
|
|
5323
|
+
stop = true;
|
|
5324
|
+
break;
|
|
5325
|
+
}
|
|
5326
|
+
if (cntTotal !== null && (current + i) * pageSize >= cntTotal) {
|
|
5327
|
+
stop = true;
|
|
5328
|
+
break;
|
|
5329
|
+
}
|
|
5326
5330
|
}
|
|
5327
|
-
|
|
5328
|
-
const got = Array.isArray(rDisp) && rDisp.length ? rDisp.length : rRaw.length;
|
|
5329
|
-
lastGot = got;
|
|
5330
|
-
if (got < pageSize) break;
|
|
5331
|
-
if (cntTotal !== null && (current + i) * pageSize >= cntTotal) break;
|
|
5331
|
+
if (stop) break;
|
|
5332
5332
|
}
|
|
5333
5333
|
const rows = hasDisplay ? dispRows : rawRows;
|
|
5334
5334
|
let workRows = rows;
|
|
@@ -5428,6 +5428,7 @@ async function runList(env, args, feedbackTodoMode) {
|
|
|
5428
5428
|
env: new URL(baseUrl).hostname,
|
|
5429
5429
|
type,
|
|
5430
5430
|
listId,
|
|
5431
|
+
menuName,
|
|
5431
5432
|
total,
|
|
5432
5433
|
totalExact,
|
|
5433
5434
|
...totalNote ? { totalNote } : {},
|
|
@@ -5527,8 +5528,7 @@ async function runList(env, args, feedbackTodoMode) {
|
|
|
5527
5528
|
outRows.push(row);
|
|
5528
5529
|
}
|
|
5529
5530
|
if (feedbackTodoMode) {
|
|
5530
|
-
const
|
|
5531
|
-
const me = cu ? cu.name : "";
|
|
5531
|
+
const me = feedbackUser?.name || "";
|
|
5532
5532
|
const st = (r) => String(r.union_status_key || r.union_status || "");
|
|
5533
5533
|
const tp = (r) => String(r.interview_type_key || r.interview_type || "");
|
|
5534
5534
|
const iv = (r) => String(r.interviewer || "");
|
|
@@ -5546,17 +5546,29 @@ async function runList(env, args, feedbackTodoMode) {
|
|
|
5546
5546
|
talent_id: r.talent_id,
|
|
5547
5547
|
position_manage_id: r.position_manage_id
|
|
5548
5548
|
});
|
|
5549
|
-
const pending = outRows.filter((r) => /待反馈/.test(st(r)));
|
|
5550
|
-
const mineAll = me ? pending.filter((r) => iv(r).includes(me)) : [];
|
|
5549
|
+
const pending = serverFilterApplied ? outRows : outRows.filter((r) => /待反馈/.test(st(r)));
|
|
5550
|
+
const mineAll = serverFilterApplied ? outRows : me ? pending.filter((r) => iv(r).includes(me)) : [];
|
|
5551
5551
|
const myAi = mineAll.filter((r) => /AI\s*面试/i.test(tp(r)));
|
|
5552
5552
|
const notes = [];
|
|
5553
5553
|
if (!me) notes.push("\u672A\u80FD\u89E3\u6790\u5F53\u524D\u767B\u5F55\u7528\u6237\uFF0C\u65E0\u6CD5\u6309\u9762\u8BD5\u5B98\u8FC7\u6EE4\uFF08\u7ED3\u679C\u4E3A\u7A7A\uFF09");
|
|
5554
|
-
if (
|
|
5555
|
-
notes.push("\u5DF2\
|
|
5554
|
+
if (serverFilterApplied) {
|
|
5555
|
+
notes.push("\u670D\u52A1\u7AEF\u5DF2\u6309\u300C\u5F85\u53CD\u9988 + \u5F53\u524D\u767B\u5F55\u4EBA\u4E3A\u9762\u8BD5\u5B98\u300D\u7B5B\u9009\uFF08commonSearchFields + in\uFF09\uFF0Ctotal \u4E3A\u8BE5\u6761\u4EF6\u4E0B\u7684\u7CBE\u786E\u6761\u6570");
|
|
5556
|
+
if (out.total !== null && outRows.length < out.total) {
|
|
5557
|
+
notes.push("\u26A0\uFE0F \u4EC5\u53D6\u56DE " + outRows.length + "/" + out.total + " \u6761\u5F85\u529E\uFF08\u7ED3\u679C\u4ECD\u53D7\u7FFB\u9875\u4E0A\u9650\u7EA6\u675F\uFF09\uFF0C\u8BF7\u52A0\u5927 maxPages \u540E\u91CD\u67E5");
|
|
5558
|
+
}
|
|
5559
|
+
} else {
|
|
5560
|
+
notes.push("\u6570\u636E\u6E90\u5217\u8868\u300C" + menuName + "\u300D\uFF08total=" + (out.total === null ? "\u4E0D\u53EF\u77E5" : out.total) + "\uFF0C\u5DF2\u626B\u63CF " + outRows.length + " \u6761\uFF09\uFF1B\u300C\u6211\u7684\u9762\u8BD5\u300D\u4E3A\u4E0E\u6211\u76F8\u5173\u8303\u56F4\uFF0C\u4ECD\u9700\u6309\u9762\u8BD5\u5B98\u4E8C\u6B21\u7B5B");
|
|
5561
|
+
if (out.total !== null && outRows.length < out.total) {
|
|
5562
|
+
notes.push("\u26A0\uFE0F \u672A\u8986\u76D6\u5168\u90E8\uFF1A\u5DF2\u626B\u63CF " + outRows.length + "/" + out.total + " \u6761\uFF08\u5217\u8868\u9ED8\u8BA4\u987A\u5E8F\uFF09\uFF0C\u6392\u5728\u540E\u9762\u7684\u5F85\u529E\u4F1A\u6F0F\u4E14\u4E0D\u62A5\u9519\uFF1B\u8BF7\u52A0\u5927 maxPages \u6216 pageSize \u540E\u91CD\u67E5");
|
|
5563
|
+
}
|
|
5556
5564
|
}
|
|
5565
|
+
out.serverFiltered = serverFilterApplied;
|
|
5566
|
+
out.currentUserId = feedbackUser?.id || null;
|
|
5557
5567
|
out.feedbackTodo = {
|
|
5558
5568
|
currentUser: me || null,
|
|
5559
5569
|
scanned: outRows.length,
|
|
5570
|
+
total: out.total,
|
|
5571
|
+
totalExact: out.totalExact,
|
|
5560
5572
|
myAiPendingFeedback: { count: myAi.length, rows: myAi.map(slim) },
|
|
5561
5573
|
myOtherPendingFeedback: {
|
|
5562
5574
|
count: mineAll.length - myAi.length,
|
|
@@ -5818,11 +5830,11 @@ async function resolvePureIds(host, ids) {
|
|
|
5818
5830
|
const batch = uniq.slice(i, i + 100);
|
|
5819
5831
|
try {
|
|
5820
5832
|
const r = await host.request({
|
|
5821
|
-
|
|
5822
|
-
|
|
5823
|
-
|
|
5833
|
+
method: "POST",
|
|
5834
|
+
path: "/api/hrm/common/browser/destData/resource",
|
|
5835
|
+
body: { browserMultiple: true, selectIds: batch.join(",") }
|
|
5824
5836
|
});
|
|
5825
|
-
for (const u of r?.data?.
|
|
5837
|
+
for (const u of r?.data?.data || []) {
|
|
5826
5838
|
if (u?.id != null) map[String(u.id)] = u.name || null;
|
|
5827
5839
|
}
|
|
5828
5840
|
} catch {
|
|
@@ -6248,10 +6260,277 @@ var searchOperations = [
|
|
|
6248
6260
|
}
|
|
6249
6261
|
];
|
|
6250
6262
|
|
|
6263
|
+
// src/shortcuts/recruit-stage/operations/tag.ts
|
|
6264
|
+
var TAG_COLORS = ["#E8F6FE", "#EAF7EA", "#FFF4E0", "#FDE9E9", "#F0EAFF", "#E8F6F7"];
|
|
6265
|
+
function colorOf(name) {
|
|
6266
|
+
let h = 0;
|
|
6267
|
+
for (let i = 0; i < name.length; i += 1) h = (h * 31 + name.charCodeAt(i)) % 1e5;
|
|
6268
|
+
return TAG_COLORS[h % TAG_COLORS.length];
|
|
6269
|
+
}
|
|
6270
|
+
function normName(v) {
|
|
6271
|
+
return String(v == null ? "" : v).trim();
|
|
6272
|
+
}
|
|
6273
|
+
async function probeTag(host, name) {
|
|
6274
|
+
const bodyOf = (type) => {
|
|
6275
|
+
const body = { type, name, order: 8, pageSize: 100, pageNo: 1, search: 1, tagGroup: 0 };
|
|
6276
|
+
if (type === 0) body.tagModules = ["recruit"];
|
|
6277
|
+
return body;
|
|
6278
|
+
};
|
|
6279
|
+
const rs = await Promise.all([0, 1].map((type) => host.request({
|
|
6280
|
+
path: "/api/my/tag/query",
|
|
6281
|
+
method: "POST",
|
|
6282
|
+
body: bodyOf(type)
|
|
6283
|
+
}).catch(() => null)));
|
|
6284
|
+
const out = {};
|
|
6285
|
+
const lower = name.toLowerCase();
|
|
6286
|
+
for (const r of rs) {
|
|
6287
|
+
const list = r?.data?.data;
|
|
6288
|
+
if (!Array.isArray(list)) continue;
|
|
6289
|
+
for (const t of list) {
|
|
6290
|
+
if (!t || !t.tagId) continue;
|
|
6291
|
+
if (normName(t.name).toLowerCase() !== lower) continue;
|
|
6292
|
+
const item = { id: String(t.tagId), name: String(t.name), type: Number(t.type ?? 0) };
|
|
6293
|
+
if (item.type === 0 && !out.publicTag) out.publicTag = item;
|
|
6294
|
+
if (item.type === 1 && !out.personalTag) out.personalTag = item;
|
|
6295
|
+
}
|
|
6296
|
+
}
|
|
6297
|
+
return out;
|
|
6298
|
+
}
|
|
6299
|
+
async function createPersonalTag(host, name) {
|
|
6300
|
+
const r = await host.request({
|
|
6301
|
+
path: "/api/my/tag/create",
|
|
6302
|
+
method: "POST",
|
|
6303
|
+
body: { name, type: 1, color: colorOf(name) }
|
|
6304
|
+
});
|
|
6305
|
+
const id = r?.data?.tagId;
|
|
6306
|
+
if (!id) throw rsFail(`\u521B\u5EFA\u4E2A\u4EBA\u6807\u7B7E\u5931\u8D25\uFF1A${name}\uFF08${r?.msg || "\u672A\u8FD4\u56DE tagId"}\uFF09`);
|
|
6307
|
+
return { id: String(id), name, type: 1 };
|
|
6308
|
+
}
|
|
6309
|
+
function normalizeRequests(raw) {
|
|
6310
|
+
if (!Array.isArray(raw)) throw rsValidationError("tags_required", "tags \u5FC5\u987B\u662F\u6570\u7EC4\uFF08\u5143\u7D20\u4E3A\u6807\u7B7E\u540D\u6216 {name, prefer, reason}\uFF09");
|
|
6311
|
+
const out = [];
|
|
6312
|
+
const seen = /* @__PURE__ */ new Set();
|
|
6313
|
+
for (const item of raw) {
|
|
6314
|
+
const obj = typeof item === "string" ? { name: item } : item || {};
|
|
6315
|
+
const name = normName(obj.name);
|
|
6316
|
+
if (!name) throw rsValidationError("tag_name_required", "\u6807\u7B7E\u540D\u4E0D\u80FD\u4E3A\u7A7A");
|
|
6317
|
+
if (seen.has(name)) continue;
|
|
6318
|
+
seen.add(name);
|
|
6319
|
+
const preferRaw = String(obj.prefer || obj.target || "auto").toLowerCase();
|
|
6320
|
+
const prefer = preferRaw === "public" ? "public" : preferRaw === "personal" ? "personal" : "auto";
|
|
6321
|
+
out.push({ name, prefer, reason: obj.reason ? String(obj.reason) : void 0 });
|
|
6322
|
+
}
|
|
6323
|
+
if (!out.length) throw rsValidationError("tags_required", "\u81F3\u5C11\u7ED9\u4E00\u4E2A\u6807\u7B7E");
|
|
6324
|
+
if (out.length > 8) throw rsValidationError("too_many_tags", "\u4E00\u6B21\u6700\u591A 8 \u4E2A\u6807\u7B7E\uFF08AI \u63A8\u8350\u5E94\u63A7\u5236\u5728\u8FD9\u4E2A\u91CF\u7EA7\uFF09");
|
|
6325
|
+
return out;
|
|
6326
|
+
}
|
|
6327
|
+
async function buildPlan2(host, args, talentId) {
|
|
6328
|
+
const requests = normalizeRequests(args.tags);
|
|
6329
|
+
const probes = await Promise.all(requests.map((rq) => probeTag(host, rq.name).catch(() => ({}))));
|
|
6330
|
+
const items = requests.map((rq, i) => {
|
|
6331
|
+
const p = probes[i] || {};
|
|
6332
|
+
if (p.publicTag && rq.prefer !== "personal") {
|
|
6333
|
+
return { name: rq.name, action: "attach-public", tagId: p.publicTag.id, type: 0, reason: rq.reason, existed: true };
|
|
6334
|
+
}
|
|
6335
|
+
if (p.personalTag) {
|
|
6336
|
+
return { name: rq.name, action: "attach-personal", tagId: p.personalTag.id, type: 1, reason: rq.reason, existed: true };
|
|
6337
|
+
}
|
|
6338
|
+
return { name: rq.name, action: "create-personal", tagId: null, type: 1, reason: rq.reason, existed: false };
|
|
6339
|
+
});
|
|
6340
|
+
const counts = {
|
|
6341
|
+
attachPublic: items.filter((x) => x.action === "attach-public").length,
|
|
6342
|
+
attachPersonal: items.filter((x) => x.action === "attach-personal").length,
|
|
6343
|
+
createPersonal: items.filter((x) => x.action === "create-personal").length
|
|
6344
|
+
};
|
|
6345
|
+
return { talentId, items, counts };
|
|
6346
|
+
}
|
|
6347
|
+
function listOperation() {
|
|
6348
|
+
return {
|
|
6349
|
+
name: "recruit-stage.tag.list",
|
|
6350
|
+
resource: "recruit.tag",
|
|
6351
|
+
method: "POST",
|
|
6352
|
+
action: "tag.list",
|
|
6353
|
+
summary: "\u5217\u51FA\u5E73\u53F0\u6807\u7B7E\u5E93\uFF08type=0 \u516C\u5171 / 1 \u4E2A\u4EBA\uFF09\uFF0C\u53EF\u6309\u5173\u952E\u8BCD\u8FC7\u6EE4\uFF1B\u7528\u4E8E\u63A8\u8350\u524D\u5148\u67E5\u91CD\u3001\u590D\u7528\u5DF2\u6709\u6807\u7B7E",
|
|
6354
|
+
capability: "recruit.tag",
|
|
6355
|
+
risk: "read",
|
|
6356
|
+
inputSchema: schemaOf({
|
|
6357
|
+
type: { type: "integer", enum: [0, 1], description: "0=\u516C\u5171\u6807\u7B7E\uFF08\u5168\u4F01\u4E1A\uFF09\uFF0C1=\u4E2A\u4EBA\u6807\u7B7E\uFF08\u4EC5\u81EA\u5DF1\u53EF\u89C1\uFF09" },
|
|
6358
|
+
keyword: { type: "string", description: "\u540D\u79F0\u5173\u952E\u8BCD\uFF08\u670D\u52A1\u7AEF\u6A21\u7CCA\u5339\u914D\uFF09" },
|
|
6359
|
+
pageSize: { type: "integer", minimum: 1, maximum: 100, description: "\u9ED8\u8BA4 50" },
|
|
6360
|
+
current: { type: "integer", minimum: 1 }
|
|
6361
|
+
}),
|
|
6362
|
+
handler: async (args, env) => {
|
|
6363
|
+
const type = Number(args.type ?? 0) === 1 ? 1 : 0;
|
|
6364
|
+
const body = {
|
|
6365
|
+
type,
|
|
6366
|
+
name: normName(args.keyword),
|
|
6367
|
+
order: 8,
|
|
6368
|
+
pageSize: Number(args.pageSize ?? 50),
|
|
6369
|
+
pageNo: Number(args.current ?? 1),
|
|
6370
|
+
search: 1,
|
|
6371
|
+
tagGroup: 0
|
|
6372
|
+
};
|
|
6373
|
+
if (type === 0) body.tagModules = ["recruit"];
|
|
6374
|
+
const r = await env.host.request({ path: "/api/my/tag/query", method: "POST", body });
|
|
6375
|
+
const list = r?.data?.data;
|
|
6376
|
+
if (!Array.isArray(list)) throw rsFail("\u6807\u7B7E\u5E93\u67E5\u8BE2\u5931\u8D25\uFF1A" + (r?.msg || "\u65E0\u8FD4\u56DE"), { response: r });
|
|
6377
|
+
return rsSuccess("tag.list", {
|
|
6378
|
+
type: type === 0 ? "public" : "personal",
|
|
6379
|
+
total: Number(r?.data?.total ?? list.length),
|
|
6380
|
+
tags: list.map((t) => ({
|
|
6381
|
+
tagId: String(t.tagId),
|
|
6382
|
+
name: String(t.name),
|
|
6383
|
+
type: Number(t.type ?? 0),
|
|
6384
|
+
color: t.color || "",
|
|
6385
|
+
creator: t.creator || ""
|
|
6386
|
+
}))
|
|
6387
|
+
});
|
|
6388
|
+
}
|
|
6389
|
+
};
|
|
6390
|
+
}
|
|
6391
|
+
function prepareOperation() {
|
|
6392
|
+
return {
|
|
6393
|
+
name: "recruit-stage.tag.attach.prepare",
|
|
6394
|
+
resource: "recruit.tag",
|
|
6395
|
+
method: "POST",
|
|
6396
|
+
action: "tag.attach.prepare",
|
|
6397
|
+
summary: "\u7ED9\u4EBA\u624D\u6302\u6807\u7B7E\u7684\u786E\u8BA4\u6458\u8981\uFF1A\u516C\u5171\u547D\u4E2D\u2192\u6302\u516C\u5171\u3001\u4E2A\u4EBA\u5DF2\u6709\u2192\u590D\u7528\u3001\u5E93\u4E2D\u4E0D\u5B58\u5728\u2192\u65B0\u5EFA\u4E2A\u4EBA\u6807\u7B7E\uFF1B\u4E0D\u843D\u5E93",
|
|
6398
|
+
capability: "recruit.tag",
|
|
6399
|
+
risk: "read",
|
|
6400
|
+
inputSchema: schemaOf({
|
|
6401
|
+
talentId: { type: "string", description: "\u4EBA\u624D id" },
|
|
6402
|
+
tags: {
|
|
6403
|
+
type: "array",
|
|
6404
|
+
description: '\u6807\u7B7E\u6E05\u5355\uFF1B\u5143\u7D20\u53EF\u4E3A\u5B57\u7B26\u4E32\uFF0C\u6216 {name, prefer:"public"|"personal"|"auto", reason}',
|
|
6405
|
+
items: { type: ["string", "object"] }
|
|
6406
|
+
}
|
|
6407
|
+
}, { required: ["talentId", "tags"] }),
|
|
6408
|
+
handler: async (args, env) => {
|
|
6409
|
+
const talentId = normName(args.talentId);
|
|
6410
|
+
if (!talentId) throw rsValidationError("talent_id_required", "\u8BF7\u63D0\u4F9B talentId");
|
|
6411
|
+
const plan = await buildPlan2(env.host, args, talentId);
|
|
6412
|
+
const existing = await Promise.all([0, 1].map(async (type) => {
|
|
6413
|
+
try {
|
|
6414
|
+
const r = await env.host.request({
|
|
6415
|
+
path: "/api/my/tag/common/queryEntityTag",
|
|
6416
|
+
method: "POST",
|
|
6417
|
+
body: { entityId: talentId, module: "ebuilderform", type }
|
|
6418
|
+
});
|
|
6419
|
+
const list = r?.data;
|
|
6420
|
+
return Array.isArray(list) ? list.map((t) => String(t.content || t.name || "")) : [];
|
|
6421
|
+
} catch {
|
|
6422
|
+
return [];
|
|
6423
|
+
}
|
|
6424
|
+
}));
|
|
6425
|
+
const continuation = await env.continuation.issue({
|
|
6426
|
+
operation: "recruit-stage.tag.attach.apply",
|
|
6427
|
+
fingerprint: JSON.stringify({ talentId, items: plan.items.map((x) => ({ name: x.name, action: x.action, tagId: x.tagId })) }),
|
|
6428
|
+
argsSnapshot: { talentId, tags: plan.items.map((x) => ({ name: x.name, action: x.action, tagId: x.tagId })) }
|
|
6429
|
+
});
|
|
6430
|
+
return rsSuccess("tag.attach.prepare", {
|
|
6431
|
+
talentId,
|
|
6432
|
+
currentTags: { public: existing[0], personal: existing[1] },
|
|
6433
|
+
items: plan.items,
|
|
6434
|
+
counts: plan.counts,
|
|
6435
|
+
note: "\u786E\u8BA4\u540E\u6267\u884C\uFF1A\u5E93\u4E2D\u5DF2\u6709\u7684\u76F4\u63A5\u6302\u3001\u5E93\u4E2D\u6CA1\u6709\u7684\u6309\u540D\u5B57\u65B0\u5EFA\u4E3A\u4E2A\u4EBA\u6807\u7B7E\u518D\u6302\uFF08\u540C\u540D\u516C\u5171\u4F18\u5148\uFF0C\u4E0D\u4F1A\u5728\u5DF2\u6709\u516C\u5171\u6807\u7B7E\u4E0B\u518D\u9020\u4E2A\u4EBA\u526F\u672C\uFF09\u3002",
|
|
6436
|
+
continuation
|
|
6437
|
+
}, { continuation });
|
|
6438
|
+
}
|
|
6439
|
+
};
|
|
6440
|
+
}
|
|
6441
|
+
function applyOperation() {
|
|
6442
|
+
return {
|
|
6443
|
+
name: "recruit-stage.tag.attach.apply",
|
|
6444
|
+
resource: "recruit.tag",
|
|
6445
|
+
method: "POST",
|
|
6446
|
+
action: "tag.attach.apply",
|
|
6447
|
+
summary: "\u786E\u8BA4\u540E\u7ED9\u4EBA\u624D\u6302\u6807\u7B7E\uFF1A\u65B0\u5EFA\u7F3A\u5931\u7684\u4E2A\u4EBA\u6807\u7B7E \u2192 batchAddEntityTag \u2192 \u56DE\u67E5\u786E\u8BA4",
|
|
6448
|
+
capability: "recruit.tag",
|
|
6449
|
+
risk: "write",
|
|
6450
|
+
requiresConfirmation: true,
|
|
6451
|
+
inputSchema: schemaOf({
|
|
6452
|
+
talentId: { type: "string" },
|
|
6453
|
+
tags: { type: "array", items: { type: ["string", "object"] }, description: "\u4E0E prepare \u76F8\u540C\uFF08\u53EF\u7701\u7565\uFF0C\u4EE5 continuation \u4E3A\u51C6\uFF09" },
|
|
6454
|
+
confirm: { type: "boolean" },
|
|
6455
|
+
continuation: { type: "string" }
|
|
6456
|
+
}, { required: ["continuation", "confirm"] }),
|
|
6457
|
+
handler: async (args, env) => {
|
|
6458
|
+
if (args.confirm !== true) throw rsConfirmationError("recruit-stage.tag.attach.apply", { hint: "\u8BF7\u5148 prepare \u5E76\u628A\u6458\u8981\u7ED9\u7528\u6237\u786E\u8BA4" });
|
|
6459
|
+
const payload = await env.continuation.verify(String(args.continuation), "recruit-stage.tag.attach.apply");
|
|
6460
|
+
const snapshot = payload?.argsSnapshot || {};
|
|
6461
|
+
const talentId = normName(args.talentId || snapshot.talentId);
|
|
6462
|
+
if (!talentId) throw rsValidationError("talent_id_required", "continuation \u7F3A\u5C11 talentId\uFF0C\u8BF7\u91CD\u65B0 prepare");
|
|
6463
|
+
const planItems = Array.isArray(snapshot.tags) ? snapshot.tags : [];
|
|
6464
|
+
if (!planItems.length) throw rsValidationError("plan_empty", "continuation \u4E2D\u6CA1\u6709\u6807\u7B7E\u8BA1\u5212\uFF0C\u8BF7\u91CD\u65B0 prepare");
|
|
6465
|
+
if (Array.isArray(args.tags) && args.tags.length) {
|
|
6466
|
+
const now = normalizeRequests(args.tags).map((x) => x.name);
|
|
6467
|
+
const planned = planItems.map((x) => x.name);
|
|
6468
|
+
if (JSON.stringify(now) !== JSON.stringify(planned)) {
|
|
6469
|
+
throw rsValidationError("plan_changed", "\u6807\u7B7E\u6E05\u5355\u4E0E\u786E\u8BA4\u6458\u8981\u4E0D\u4E00\u81F4\uFF0C\u8BF7\u91CD\u65B0 prepare");
|
|
6470
|
+
}
|
|
6471
|
+
}
|
|
6472
|
+
const created = [];
|
|
6473
|
+
const attach = [];
|
|
6474
|
+
for (const item of planItems) {
|
|
6475
|
+
if (item.action === "create-personal") {
|
|
6476
|
+
const p = await probeTag(env.host, item.name).catch(() => ({}));
|
|
6477
|
+
const hit = p.personalTag || p.publicTag;
|
|
6478
|
+
if (hit) {
|
|
6479
|
+
attach.push({ id: hit.id, name: hit.name, type: hit.type, from: "reused-after-create-probe" });
|
|
6480
|
+
continue;
|
|
6481
|
+
}
|
|
6482
|
+
const t = await createPersonalTag(env.host, item.name);
|
|
6483
|
+
created.push({ name: t.name, id: t.id });
|
|
6484
|
+
attach.push({ id: t.id, name: t.name, type: 1, from: "created" });
|
|
6485
|
+
continue;
|
|
6486
|
+
}
|
|
6487
|
+
if (!item.tagId) throw rsFail(`\u6807\u7B7E\u300C${item.name}\u300D\u7F3A\u5C11 tagId\uFF0C\u8BF7\u91CD\u65B0 prepare`);
|
|
6488
|
+
attach.push({ id: String(item.tagId), name: item.name, type: item.action === "attach-public" ? 0 : 1, from: "existing" });
|
|
6489
|
+
}
|
|
6490
|
+
const write = await env.host.request({
|
|
6491
|
+
path: "/api/my/tag/common/batchAddEntityTag",
|
|
6492
|
+
method: "POST",
|
|
6493
|
+
body: {
|
|
6494
|
+
tags: attach.map((x) => ({ id: x.id, name: x.name, type: x.type })),
|
|
6495
|
+
batchDatas: [{ entityId: talentId, module: "ebuilderform" }]
|
|
6496
|
+
}
|
|
6497
|
+
});
|
|
6498
|
+
if (write?.status === false) {
|
|
6499
|
+
throw rsFail("\u6302\u6807\u7B7E\u5931\u8D25\uFF1A" + (write?.msg || "\u63A5\u53E3\u8FD4\u56DE\u5931\u8D25"), { created, attach });
|
|
6500
|
+
}
|
|
6501
|
+
const after = { public: [], personal: [] };
|
|
6502
|
+
for (const type of [0, 1]) {
|
|
6503
|
+
try {
|
|
6504
|
+
const r = await env.host.request({
|
|
6505
|
+
path: "/api/my/tag/common/queryEntityTag",
|
|
6506
|
+
method: "POST",
|
|
6507
|
+
body: { entityId: talentId, module: "ebuilderform", type }
|
|
6508
|
+
});
|
|
6509
|
+
const list = r?.data;
|
|
6510
|
+
const names = Array.isArray(list) ? list.map((t) => String(t.content || t.name || "")) : [];
|
|
6511
|
+
if (type === 0) after.public = names;
|
|
6512
|
+
else after.personal = names;
|
|
6513
|
+
} catch {
|
|
6514
|
+
}
|
|
6515
|
+
}
|
|
6516
|
+
const missing = attach.filter((x) => !(x.type === 0 ? after.public : after.personal).includes(x.name)).map((x) => x.name);
|
|
6517
|
+
return rsSuccess("tag.attach.apply", {
|
|
6518
|
+
talentId,
|
|
6519
|
+
created,
|
|
6520
|
+
attached: attach,
|
|
6521
|
+
after,
|
|
6522
|
+
verification: { ok: missing.length === 0, missing }
|
|
6523
|
+
});
|
|
6524
|
+
}
|
|
6525
|
+
};
|
|
6526
|
+
}
|
|
6527
|
+
var tagOperations = [listOperation(), prepareOperation(), applyOperation()];
|
|
6528
|
+
|
|
6251
6529
|
// src/shortcuts/recruit-stage/operations/registry.ts
|
|
6252
6530
|
var definitions = [
|
|
6253
6531
|
...searchOperations,
|
|
6254
6532
|
...listOperations,
|
|
6533
|
+
...tagOperations,
|
|
6255
6534
|
...jdCreateOperations,
|
|
6256
6535
|
...resumeImportOperations,
|
|
6257
6536
|
...interviewArrangeOperations,
|
|
@@ -6314,15 +6593,15 @@ var recruitStageManifest = {
|
|
|
6314
6593
|
host: "e10-recruit-stage",
|
|
6315
6594
|
status: "builtin",
|
|
6316
6595
|
sourceSkill: "weaver-e10-recruit-stage",
|
|
6317
|
-
capabilities: ["recruit.jd.create", "recruit.resume.import", "recruit.interview.arrange", "recruit.interview.feedback", "recruit.list", "recruit.candidate.search"],
|
|
6596
|
+
capabilities: ["recruit.jd.create", "recruit.resume.import", "recruit.interview.arrange", "recruit.interview.feedback", "recruit.list", "recruit.candidate.search", "recruit.tag"],
|
|
6318
6597
|
operations: buildOperations(),
|
|
6319
6598
|
withheldOperations: []
|
|
6320
6599
|
};
|
|
6321
6600
|
|
|
6322
6601
|
// src/shortcuts/recruit-stage/context.ts
|
|
6323
|
-
import { join as join4, resolve as resolve4 } from "node:path";
|
|
6602
|
+
import { join as join4, resolve as resolve4, dirname as dirname2 } from "node:path";
|
|
6324
6603
|
import { existsSync as existsSync2 } from "node:fs";
|
|
6325
|
-
import { readFile as readFile2 } from "node:fs/promises";
|
|
6604
|
+
import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2 } from "node:fs/promises";
|
|
6326
6605
|
import { homedir as homedir4 } from "node:os";
|
|
6327
6606
|
var flowMemo = /* @__PURE__ */ new Map();
|
|
6328
6607
|
var SELFUSE_DEFAULT_FLOW = {
|
|
@@ -6371,6 +6650,34 @@ async function readLegacyCacheExtra(baseUrl) {
|
|
|
6371
6650
|
return { defaultRecruitFlow: null, digitalHumanMenu: null };
|
|
6372
6651
|
}
|
|
6373
6652
|
}
|
|
6653
|
+
var FLOW_MISS_TTL_MS = 6 * 60 * 60 * 1e3;
|
|
6654
|
+
function flowMissPath(baseUrl) {
|
|
6655
|
+
const hostDir = cacheDirFor(baseUrl);
|
|
6656
|
+
const hostName = hostDir.split(/[\\/]/).pop() || "unknown";
|
|
6657
|
+
return join4(hostDir, "..", `_recruit-stage`, `flow-miss-${hostName}.json`);
|
|
6658
|
+
}
|
|
6659
|
+
async function readFlowMissAt(baseUrl) {
|
|
6660
|
+
if (process.env.E10_RS_NO_FLOW_CACHE === "1") return null;
|
|
6661
|
+
try {
|
|
6662
|
+
const raw = JSON.parse(await readFile2(flowMissPath(baseUrl), "utf8"));
|
|
6663
|
+
if (raw?.baseUrl !== baseUrl || !raw?.missedAt) return null;
|
|
6664
|
+
if (Date.now() - raw.missedAt > FLOW_MISS_TTL_MS) return null;
|
|
6665
|
+
return raw.missedAt;
|
|
6666
|
+
} catch {
|
|
6667
|
+
return null;
|
|
6668
|
+
}
|
|
6669
|
+
}
|
|
6670
|
+
async function writeFlowMiss(baseUrl) {
|
|
6671
|
+
if (process.env.E10_RS_NO_FLOW_CACHE === "1") return;
|
|
6672
|
+
try {
|
|
6673
|
+
const dir = cacheDirFor(baseUrl);
|
|
6674
|
+
if (!existsSync2(dir)) return;
|
|
6675
|
+
const target = flowMissPath(baseUrl);
|
|
6676
|
+
await mkdir2(dirname2(target), { recursive: true });
|
|
6677
|
+
await writeFile2(target, JSON.stringify({ baseUrl, missedAt: Date.now() }), "utf8");
|
|
6678
|
+
} catch {
|
|
6679
|
+
}
|
|
6680
|
+
}
|
|
6374
6681
|
function findFlowMenu(cache) {
|
|
6375
6682
|
const all = (cache.lists || {}).all_search || [];
|
|
6376
6683
|
const hit = all.find((m) => m && m.listId && /招聘流程/.test(String(m.menuName || "")));
|
|
@@ -6396,8 +6703,10 @@ async function resolveDefaultRecruitFlow(host, baseUrl, appId, cache) {
|
|
|
6396
6703
|
flowMemo.set(memoKey, legacy.defaultRecruitFlow);
|
|
6397
6704
|
return legacy.defaultRecruitFlow;
|
|
6398
6705
|
}
|
|
6706
|
+
const missFresh = await readFlowMissAt(baseUrl);
|
|
6399
6707
|
let result = null;
|
|
6400
|
-
|
|
6708
|
+
let serverResolved = false;
|
|
6709
|
+
const menu = missFresh ? null : findFlowMenu(cache);
|
|
6401
6710
|
if (menu) {
|
|
6402
6711
|
try {
|
|
6403
6712
|
let flowObjId = "";
|
|
@@ -6441,13 +6750,16 @@ async function resolveDefaultRecruitFlow(host, baseUrl, appId, cache) {
|
|
|
6441
6750
|
if (pick) {
|
|
6442
6751
|
const id = String(pick.form_data_id || pick.id || "");
|
|
6443
6752
|
const name = String(pick.name || pick.flow_name || pick.content || "");
|
|
6444
|
-
if (id && name)
|
|
6753
|
+
if (id && name) {
|
|
6754
|
+
result = { id, name };
|
|
6755
|
+
serverResolved = true;
|
|
6756
|
+
}
|
|
6445
6757
|
}
|
|
6446
6758
|
}
|
|
6447
6759
|
} catch {
|
|
6448
6760
|
}
|
|
6449
6761
|
}
|
|
6450
|
-
if (!result) {
|
|
6762
|
+
if (!result && !missFresh) {
|
|
6451
6763
|
try {
|
|
6452
6764
|
const r = await host.request({
|
|
6453
6765
|
path: "/api/recruit/position/recruitFlow/list",
|
|
@@ -6460,6 +6772,7 @@ async function resolveDefaultRecruitFlow(host, baseUrl, appId, cache) {
|
|
|
6460
6772
|
const enabled = list.find(isDefaultFlowRow) || null;
|
|
6461
6773
|
if (enabled?.id) {
|
|
6462
6774
|
result = { id: String(enabled.id), name: String(enabled.name || enabled.flow_name || "") };
|
|
6775
|
+
serverResolved = true;
|
|
6463
6776
|
}
|
|
6464
6777
|
} catch {
|
|
6465
6778
|
}
|
|
@@ -6476,7 +6789,12 @@ async function resolveDefaultRecruitFlow(host, baseUrl, appId, cache) {
|
|
|
6476
6789
|
result = { id: SELFUSE_DEFAULT_FLOW.id, name: SELFUSE_DEFAULT_FLOW.name };
|
|
6477
6790
|
}
|
|
6478
6791
|
}
|
|
6479
|
-
if (
|
|
6792
|
+
if (serverResolved) {
|
|
6793
|
+
flowMemo.set(memoKey, result);
|
|
6794
|
+
} else {
|
|
6795
|
+
if (!missFresh) await writeFlowMiss(baseUrl);
|
|
6796
|
+
flowMemo.set(memoKey, result);
|
|
6797
|
+
}
|
|
6480
6798
|
return result;
|
|
6481
6799
|
}
|
|
6482
6800
|
async function resolveDigitalHumanMenu(host, baseUrl, cache) {
|