weaver-work-cli 0.1.44 → 0.1.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -5
- package/dist/chunks/{archive-P6TBQGKL.js → archive-ZQ4A4TV6.js} +388 -44
- package/dist/chunks/{archive-oa-7TQ2NXOH.js → archive-oa-BBDP7AKJ.js} +2 -2
- package/dist/chunks/{asset-3ELRG37G.js → asset-ZOJVBWZH.js} +2 -2
- package/dist/chunks/{asset-idle-WIGMUFMD.js → asset-idle-XGB5IPGT.js} +2 -2
- package/dist/chunks/{attachment-content-E3276UOV.js → attachment-content-CE3GMWTS.js} +3 -3
- package/dist/chunks/{blog-C5NMZAAC.js → blog-QSHLZSFW.js} +2 -2
- package/dist/chunks/caizhilian-KCQYFH72.js +204 -0
- package/dist/chunks/{calendar-FI2WNSBO.js → calendar-DLGMRJQA.js} +2 -2
- package/dist/chunks/{chunk-CWYGFU5B.js → chunk-3WBIQLMB.js} +2 -2
- package/dist/chunks/{chunk-PUQS5MWL.js → chunk-3YV7PKRL.js} +1 -1
- package/dist/chunks/{chunk-PC7VKEB5.js → chunk-3ZMAQQ3W.js} +161 -33
- package/dist/chunks/{chunk-GM6J7Q4B.js → chunk-4EXOIQDI.js} +40 -10
- package/dist/chunks/{chunk-ETNJSKMM.js → chunk-6NXT4ICB.js} +148 -21
- package/dist/chunks/chunk-762M5XJS.js +215 -0
- package/dist/chunks/{chunk-GAMZLAG2.js → chunk-77YP6I52.js} +1 -1
- package/dist/chunks/{chunk-WSF4NNMR.js → chunk-CZNZKOHR.js} +2 -2
- package/dist/chunks/{chunk-Z7VYWPZV.js → chunk-DGMYACGJ.js} +1 -1
- package/dist/chunks/{chunk-TA7FXXJD.js → chunk-DLY5GUXX.js} +1 -1
- package/dist/chunks/{chunk-BCVYBYYT.js → chunk-GR76ZDDX.js} +2 -2
- package/dist/chunks/{chunk-GRDRG6HP.js → chunk-HFXK54M4.js} +2 -2
- package/dist/chunks/{chunk-XNIK66I4.js → chunk-JB34OE7R.js} +790 -77
- package/dist/chunks/{chunk-QVSWRLLU.js → chunk-JWWTI63L.js} +55 -5
- package/dist/chunks/{chunk-FRZKBMSW.js → chunk-LGKWL4OH.js} +176 -39
- package/dist/chunks/{chunk-XHK4MDR5.js → chunk-LRCPNDZA.js} +38 -6
- package/dist/chunks/{chunk-OF4S23UB.js → chunk-LXFVWZLM.js} +4 -4
- package/dist/chunks/{chunk-D4ADSZ7H.js → chunk-O6CMPO65.js} +24 -1
- package/dist/chunks/{chunk-N4M2DDFE.js → chunk-OAE3AZBQ.js} +11 -11
- package/dist/chunks/chunk-P5GQRWDC.js +60 -0
- package/dist/chunks/{caizhilian-5XSM2DFP.js → chunk-PGO4ILMQ.js} +41 -521
- package/dist/chunks/{chunk-HIT4Y6OI.js → chunk-T4MWQAQB.js} +7 -5
- package/dist/chunks/{chunk-F4E4EM35.js → chunk-TGAGQV4I.js} +2 -2
- package/dist/chunks/{chunk-UFIT2UU3.js → chunk-U6R6FZHD.js} +168 -14
- package/dist/chunks/{chunk-FAZTGX7S.js → chunk-VIMCY4DI.js} +5 -5
- package/dist/chunks/chunk-VRPH24IC.js +76 -0
- package/dist/chunks/{chunk-3YBDYOC4.js → chunk-YIKSL36S.js} +2 -2
- package/dist/chunks/{chunk-IAZ3UPY6.js → chunk-Z6UUBY37.js} +2 -2
- package/dist/chunks/{conflict-ARLSZJ6V.js → conflict-IYJETSGT.js} +2 -2
- package/dist/chunks/continuation-GW6PRWK3.js +12 -0
- package/dist/chunks/{contract-DNIIW5VJ.js → contract-3QLAGYQL.js} +5793 -4591
- package/dist/chunks/{cowork-GMLRGVIW.js → cowork-3ACICHDQ.js} +2 -2
- package/dist/chunks/{create-flow-J22BO65E.js → create-flow-7JLC7UID.js} +6 -6
- package/dist/chunks/{ebuilder-form-ANV2FHYV.js → ebuilder-form-GWDTKEI2.js} +5 -5
- package/dist/chunks/{ehr-GSTGAIY3.js → ehr-MYRDCHZ4.js} +121 -49
- package/dist/chunks/{employee-22BGJ3QS.js → employee-NOHNXC46.js} +1 -1
- package/dist/chunks/{env-BX3VRFS7.js → env-3MBHAWBL.js} +2 -2
- package/dist/chunks/{esb-ATAIASX2.js → esb-4BQHNP5C.js} +4 -4
- package/dist/chunks/{factory-PETTFME6.js → factory-TZEVU4DU.js} +1 -1
- package/dist/chunks/{fna-YEKBSFSX.js → fna-ZVB2IILI.js} +2 -2
- package/dist/chunks/{group-chat-BFVXAYFX.js → group-chat-KL3HFKRM.js} +3 -3
- package/dist/chunks/{host-WIKN2EJ5.js → host-3TNBMDTR.js} +3 -3
- package/dist/chunks/host-7NTIBSPK.js +25 -0
- package/dist/chunks/{host-SZGV4UNT.js → host-7OWWPLM4.js} +3 -3
- package/dist/chunks/{host-HRBXEPDQ.js → host-G3VU7SDW.js} +3 -3
- package/dist/chunks/{host-LR55CTHP.js → host-M4XP5URR.js} +3 -3
- package/dist/chunks/{host-SUOY6VYQ.js → host-TUOIOEMC.js} +3 -3
- package/dist/chunks/{hrm-NRDO4W5G.js → hrm-UNKCCCGP.js} +5 -5
- package/dist/chunks/{im-IQ2HN23S.js → im-NJB7ZYMH.js} +3 -3
- package/dist/chunks/{invoice-MNRW76PP.js → invoice-OQP3TMKQ.js} +3 -3
- package/dist/chunks/{jiuchuanhui-DTRBAX4N.js → jiuchuanhui-ASFZBMPU.js} +2 -2
- package/dist/chunks/{lazy-dispatch-ZVWAI25B.js → lazy-dispatch-UH6HGK2I.js} +4 -4
- package/dist/chunks/{mail-ZVAUXOJA.js → mail-M3HJF5ER.js} +2 -2
- package/dist/chunks/{meeting-FEVPZ67S.js → meeting-C67EHQ4Z.js} +12 -12
- package/dist/chunks/{okr-SDH3E5RA.js → okr-EVX7FB5G.js} +2 -2
- package/dist/chunks/operations-J7PUIVWZ.js +15 -0
- package/dist/chunks/{plan-E35JFDI7.js → plan-2QJQEPBO.js} +2 -2
- package/dist/chunks/{project-73QXBAB2.js → project-XELELW2T.js} +2 -2
- package/dist/chunks/{reception-UWZVACBN.js → reception-5WITA44R.js} +2 -2
- package/dist/chunks/{recruit-stage-4MAOCKFY.js → recruit-stage-AHY5QAMF.js} +450 -117
- package/dist/chunks/{registry-JDUS4E7D.js → registry-AQVGHUM6.js} +2 -2
- package/dist/chunks/{registry-KNKSCJNT.js → registry-QJCZ2GVG.js} +4 -4
- package/dist/chunks/{registry-PO7SI256.js → registry-VWXWPVAG.js} +2 -2
- package/dist/chunks/{registry-IM5G23LS.js → registry-XPWPGHYE.js} +10 -10
- package/dist/chunks/{room-recommend-H7KLXA5R.js → room-recommend-CNWE5WQK.js} +6 -4
- package/dist/chunks/{schedule-ESZIBAUO.js → schedule-YYNYBQIE.js} +4 -4
- package/dist/chunks/{workflow-CWJFJLQU.js → workflow-BSYT5TGL.js} +6 -4
- package/dist/index.js +30 -30
- package/dist/internal/e10/auth/commands.js +32 -0
- package/dist/internal/e10/auth/error-log.js +156 -26
- package/dist/internal/e10/auth/xiaoe.js +176 -13
- package/dist/internal/e10/context.js +12 -1
- package/dist/shortcuts/archive/operations/borrow-list.js +105 -14
- package/dist/shortcuts/archive/operations/flow-url.js +182 -22
- package/dist/shortcuts/archive/operations/getPageUrl.js +75 -0
- package/dist/shortcuts/archive/operations/prelib.js +33 -4
- package/dist/shortcuts/archive/operations/shared.js +52 -0
- package/dist/shortcuts/contract/host.js +111 -4
- package/dist/shortcuts/contract/index.js +19 -0
- package/dist/shortcuts/contract/manifest.js +125 -0
- package/dist/shortcuts/contract/ooxml/clause-insert.js +249 -0
- package/dist/shortcuts/contract/operations/clause-insert.js +56 -0
- package/dist/shortcuts/contract/operations/customer.js +192 -0
- package/dist/shortcuts/contract/operations/file-download.js +75 -0
- package/dist/shortcuts/contract/operations/flow.js +44 -2
- package/dist/shortcuts/contract/operations/form-info.js +162 -62
- package/dist/shortcuts/contract/operations/registry.js +8 -0
- package/dist/shortcuts/contract/operations/review.js +116 -1
- package/dist/shortcuts/contract/operations/summary.js +177 -0
- package/dist/shortcuts/contract/operations/upload.js +64 -4
- package/dist/shortcuts/contract/upload-cache.js +104 -0
- package/dist/shortcuts/ehr/operations/recruit-candidate-import.js +4 -2
- package/dist/shortcuts/ehr/operations/recruit-position.js +136 -35
- package/dist/shortcuts/ehr/operations/recruit-write.js +17 -18
- package/dist/shortcuts/ehr/operations/recruit.js +17 -5
- package/dist/shortcuts/hrm/operations/employee.js +29 -1
- package/dist/shortcuts/meeting/operations/eb/create-flow.js +182 -58
- package/dist/shortcuts/meeting/operations/eb/draft-memory.js +56 -0
- package/dist/shortcuts/meeting/operations/eb/factory.js +58 -3
- package/dist/shortcuts/meeting/operations/eb/person-cache.js +2 -2
- package/dist/shortcuts/meeting/operations/eb/room-recommend.js +47 -5
- package/dist/shortcuts/meeting/operations/invitation-publish.js +132 -0
- package/dist/shortcuts/meeting/operations/registry.js +2 -0
- package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +86 -16
- package/dist/shortcuts/recruit-stage/operations/interview-feedback.js +6 -4
- package/dist/shortcuts/recruit-stage/operations/jd-create.js +208 -56
- package/dist/shortcuts/recruit-stage/operations/resume-import.js +42 -16
- package/dist/shortcuts/recruit-stage/shared.js +161 -18
- package/dist/shortcuts/workflow/index.js +2 -0
- package/dist/shortcuts/workflow/operations/read.js +8 -3
- package/dist/shortcuts/workflow/operations/todoSmartConvert/aigroupRules.js +92 -5
- package/dist/shortcuts/workflow/operations/todoSmartConvert/priorityExpr.js +509 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoListRows.js +22 -1
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +32 -6
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +57 -11
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.group.js +165 -52
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +57 -14
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.smartGroup.js +44 -18
- package/docs/contract.md +1 -0
- package/docs/e10-auth.md +4 -2
- package/docs/todo-smart-convert/data-contract.md +7 -0
- package/package.json +1 -1
- package/skill-template/domains/jinchengda.md +2 -0
- package/skills/weaver-e10-jinchengda/SKILL.md +198 -205
- package/skills/weaver-e10-jinchengda/references/contract-action-card.md +759 -0
- package/skills/weaver-e10-jinchengda/references/contract-action-engine.md +250 -0
- package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +146 -7
- package/skills/weaver-e10-jinchengda/references/contract-clause-insert.md +178 -0
- package/skills/weaver-e10-jinchengda/references/contract-command-index.md +75 -0
- package/skills/weaver-e10-jinchengda/references/contract-compare-report-template.html +137 -0
- package/skills/weaver-e10-jinchengda/references/contract-compare-report.md +163 -0
- package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +52 -3
- package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +92 -5
- package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +602 -0
- package/skills/weaver-e10-jinchengda/references/contract-element-extract.md +209 -0
- package/skills/weaver-e10-jinchengda/references/contract-execution-rules.md +126 -0
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-new-customer.md +312 -0
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +555 -0
- package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +47 -12
- package/skills/weaver-e10-jinchengda/references/contract-object-detect.md +469 -0
- package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +154 -1
- package/skills/weaver-e10-jinchengda/references/contract-type-fingerprints.md +224 -0
- package/skills/weaver-e10-jinchengda/references/orchestration.md +355 -0
- package/skills/weaver-e10-jucailin/references/recruit-create.md +5 -3
- package/skills/weaver-e10-jucailin/references/recruit-write.md +2 -2
- package/skills/weaver-e10-meeting/SKILL.md +57 -9
- package/skills/weaver-e10-recruit-stage/SKILL.md +11 -6
- package/skills/weaver-e10-recruit-stage/agents/openai.yaml +10 -2
- package/skills/weaver-e10-recruit-stage/references/position-templates.md +3 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +13 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +19 -18
- package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +27 -14
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +7 -1
- package/skills/weaver-e10-shared/references/e10-auth-and-session.md +4 -2
- package/skills/weaver-e10-wenshuding/SKILL.md +17 -7
- package/skills/weaver-e10-wenshuding/references/archive-borrow-list.md +28 -0
- package/skills/weaver-e10-wenshuding/references/archive-flow.md +24 -8
- package/skills/weaver-e10-wenshuding/references/archive-prelib-list.md +3 -0
- package/skills/weaver-e10-wenshuding/references/archive-prelib-open.md +4 -0
- package/skills/weaver-e10-wenshuding/references/archive-search.md +3 -1
- package/skills/weaver-e10-workflow/SKILL.md +19 -17
- package/skills/weaver-e10-workflow/aigroup/default.json +10 -6
- package/skills/weaver-e10-workflow/references/todo-smart-convert.md +36 -3
- package/skills/weaver-e10-workflow/references/workflow-memory.md +1 -1
- package/skills/weaver-e10-workflow/references/workflow-query.md +9 -6
- package/skills/weaver-e10-workflow/tools/todo-summary.cjs +152 -1
- package/skills/weaver-e10-yimiaoban/SKILL.md +17 -5
- package/skills/weaver-e10-yimiaoban/references/msg-write.md +30 -0
- package/skills/weaver-e10-yimiaoban/references/session-sysmsg.md +72 -0
- package/skills/weaver-e10-yimiaoban/references/source-manifest.json +7 -7
|
@@ -2,6 +2,7 @@ import { createHash } from 'node:crypto';
|
|
|
2
2
|
import { readFile, stat } from 'node:fs/promises';
|
|
3
3
|
import { basename, resolve } from 'node:path';
|
|
4
4
|
import { contractPolicyError, contractValidationError } from '../errors.js';
|
|
5
|
+
import { fingerprintKey, isCacheEnabled, lookupUpload, rememberUpload, sha256Of, } from '../upload-cache.js';
|
|
5
6
|
const MAX_FILE_BYTES = 200 * 1024 * 1024;
|
|
6
7
|
const DEFAULT_UPLOAD_TIMEOUT_MS = 120_000;
|
|
7
8
|
const DOC_EXTENSIONS = new Set(['.doc', '.docx']);
|
|
@@ -38,6 +39,37 @@ export async function uploadFile(host, options) {
|
|
|
38
39
|
const buffer = await readFile(absolutePath);
|
|
39
40
|
const md5 = createHash('md5').update(buffer).digest('hex');
|
|
40
41
|
const modified = String(Math.trunc(info.mtimeMs));
|
|
42
|
+
const sha256 = sha256Of(buffer);
|
|
43
|
+
// ---- 本地指纹复用:同一份文件在同一 module / 环境 / 用户下只真正上传一次 ----
|
|
44
|
+
// E10 的 preUploadCheck 在 ebContract 下不按 MD5 秒传,重传必产生新 fileId(实测),
|
|
45
|
+
// 因此去重只能在这里做。缓存不可用时静默跳过,不影响上传。
|
|
46
|
+
let reuseKey = null;
|
|
47
|
+
if (isCacheEnabled()) {
|
|
48
|
+
try {
|
|
49
|
+
const session = await host.getSession();
|
|
50
|
+
reuseKey = fingerprintKey({
|
|
51
|
+
sha256,
|
|
52
|
+
module: options.module,
|
|
53
|
+
baseUrl: session.baseUrl,
|
|
54
|
+
userId: session.userId ?? '',
|
|
55
|
+
});
|
|
56
|
+
const hit = await lookupUpload(reuseKey);
|
|
57
|
+
if (hit) {
|
|
58
|
+
return {
|
|
59
|
+
fileId: hit.fileId,
|
|
60
|
+
docId: hit.docId,
|
|
61
|
+
name: hit.name || name,
|
|
62
|
+
size: hit.size,
|
|
63
|
+
md5: hit.md5,
|
|
64
|
+
sha256,
|
|
65
|
+
reused: true,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
reuseKey = null;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
41
73
|
const form = {
|
|
42
74
|
compressImg: 'false',
|
|
43
75
|
module: options.module,
|
|
@@ -61,12 +93,26 @@ export async function uploadFile(host, options) {
|
|
|
61
93
|
const precheckData = (precheck?.data ?? {});
|
|
62
94
|
const secondUploadId = pickFileId(precheckData);
|
|
63
95
|
if (secondUploadId) {
|
|
96
|
+
const reusedDocId = text(precheckData.docId) ?? text(precheckData.uploadModuleDto?.docId);
|
|
97
|
+
const reusedName = text(precheckData.name) ?? text(precheckData.uploadModuleDto?.name) ?? name;
|
|
98
|
+
if (reuseKey) {
|
|
99
|
+
await rememberUpload(reuseKey, {
|
|
100
|
+
fileId: secondUploadId,
|
|
101
|
+
docId: reusedDocId,
|
|
102
|
+
name: reusedName,
|
|
103
|
+
size: buffer.length,
|
|
104
|
+
md5,
|
|
105
|
+
sha256,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
64
108
|
return {
|
|
65
109
|
fileId: secondUploadId,
|
|
66
|
-
docId:
|
|
67
|
-
name:
|
|
110
|
+
docId: reusedDocId,
|
|
111
|
+
name: reusedName,
|
|
68
112
|
size: buffer.length,
|
|
69
113
|
md5,
|
|
114
|
+
sha256,
|
|
115
|
+
reused: false,
|
|
70
116
|
};
|
|
71
117
|
}
|
|
72
118
|
const preUploadId = text(precheckData.preUploadId);
|
|
@@ -90,12 +136,26 @@ export async function uploadFile(host, options) {
|
|
|
90
136
|
if (!fileId) {
|
|
91
137
|
throw contractPolicyError('upload_no_fileid', '上传接口未返回 fileId,上传未完成;请核对登录态、module 与文件本体是否随请求发送', { module: options.module });
|
|
92
138
|
}
|
|
139
|
+
const finalDocId = text(uploadData.docId) ?? text(uploadData.uploadModuleDto?.docId);
|
|
140
|
+
const finalName = text(uploadData.name) ?? name;
|
|
141
|
+
if (reuseKey) {
|
|
142
|
+
await rememberUpload(reuseKey, {
|
|
143
|
+
fileId,
|
|
144
|
+
docId: finalDocId,
|
|
145
|
+
name: finalName,
|
|
146
|
+
size: buffer.length,
|
|
147
|
+
md5,
|
|
148
|
+
sha256,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
93
151
|
return {
|
|
94
152
|
fileId,
|
|
95
|
-
docId:
|
|
96
|
-
name:
|
|
153
|
+
docId: finalDocId,
|
|
154
|
+
name: finalName,
|
|
97
155
|
size: buffer.length,
|
|
98
156
|
md5,
|
|
157
|
+
sha256,
|
|
158
|
+
reused: false,
|
|
99
159
|
};
|
|
100
160
|
}
|
|
101
161
|
export function assertContractDocument(path) {
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
3
|
+
import { homedir } from 'node:os';
|
|
4
|
+
import { dirname, resolve } from 'node:path';
|
|
5
|
+
const CACHE_VERSION = 1;
|
|
6
|
+
const MAX_ENTRIES = 200;
|
|
7
|
+
const DEFAULT_TTL_MS = 24 * 60 * 60 * 1000;
|
|
8
|
+
function cacheRoot() {
|
|
9
|
+
const home = process.env.WEAVER_WORK_CLI_HOME
|
|
10
|
+
|| process.env.WORK_CLI_HOME
|
|
11
|
+
|| resolve(homedir(), '.weaver-work-cli');
|
|
12
|
+
return resolve(home, 'contract');
|
|
13
|
+
}
|
|
14
|
+
export function cacheFilePath() {
|
|
15
|
+
return resolve(cacheRoot(), 'upload-cache.json');
|
|
16
|
+
}
|
|
17
|
+
/** TTL 可由环境变量覆盖,0 表示禁用缓存。 */
|
|
18
|
+
function ttlMs() {
|
|
19
|
+
const raw = process.env.WEAVER_CONTRACT_UPLOAD_CACHE_TTL_MS;
|
|
20
|
+
if (raw === undefined)
|
|
21
|
+
return DEFAULT_TTL_MS;
|
|
22
|
+
const parsed = Number(raw);
|
|
23
|
+
return Number.isFinite(parsed) && parsed >= 0 ? parsed : DEFAULT_TTL_MS;
|
|
24
|
+
}
|
|
25
|
+
export function isCacheEnabled() {
|
|
26
|
+
return ttlMs() > 0;
|
|
27
|
+
}
|
|
28
|
+
/** 指纹键:内容哈希 + module + 环境 + 用户,任一不同都不复用。 */
|
|
29
|
+
export function fingerprintKey(input) {
|
|
30
|
+
return createHash('sha256')
|
|
31
|
+
.update(`${input.sha256}|${input.module}|${input.baseUrl}|${input.userId}`)
|
|
32
|
+
.digest('hex');
|
|
33
|
+
}
|
|
34
|
+
export function sha256Of(buffer) {
|
|
35
|
+
return createHash('sha256').update(buffer).digest('hex');
|
|
36
|
+
}
|
|
37
|
+
async function readCache() {
|
|
38
|
+
try {
|
|
39
|
+
const raw = (await readFile(cacheFilePath(), 'utf8')).replace(/^\uFEFF/u, '');
|
|
40
|
+
const parsed = JSON.parse(raw);
|
|
41
|
+
if (!parsed || parsed.version !== CACHE_VERSION || typeof parsed.entries !== 'object') {
|
|
42
|
+
return { version: CACHE_VERSION, entries: {} };
|
|
43
|
+
}
|
|
44
|
+
return parsed;
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return { version: CACHE_VERSION, entries: {} };
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
async function writeCache(cache) {
|
|
51
|
+
try {
|
|
52
|
+
const path = cacheFilePath();
|
|
53
|
+
await mkdir(dirname(path), { recursive: true });
|
|
54
|
+
await writeFile(path, JSON.stringify(cache), 'utf8');
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
// 缓存写不进去不影响业务:下一次只是重新上传而已。
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/** 命中则返回条目(并累加命中次数),未命中或过期返回 null。 */
|
|
61
|
+
export async function lookupUpload(key) {
|
|
62
|
+
if (!isCacheEnabled())
|
|
63
|
+
return null;
|
|
64
|
+
const cache = await readCache();
|
|
65
|
+
const entry = cache.entries[key];
|
|
66
|
+
if (!entry)
|
|
67
|
+
return null;
|
|
68
|
+
const age = Date.now() - entry.updatedAt;
|
|
69
|
+
if (age > ttlMs()) {
|
|
70
|
+
delete cache.entries[key];
|
|
71
|
+
await writeCache(cache);
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
entry.hits = (entry.hits ?? 0) + 1;
|
|
75
|
+
await writeCache(cache);
|
|
76
|
+
return entry;
|
|
77
|
+
}
|
|
78
|
+
/** 上传成功后登记指纹;同一键覆盖,并按 updatedAt 做容量裁剪。 */
|
|
79
|
+
export async function rememberUpload(key, entry) {
|
|
80
|
+
if (!isCacheEnabled())
|
|
81
|
+
return;
|
|
82
|
+
const cache = await readCache();
|
|
83
|
+
const previous = cache.entries[key];
|
|
84
|
+
cache.entries[key] = {
|
|
85
|
+
...entry,
|
|
86
|
+
updatedAt: Date.now(),
|
|
87
|
+
hits: previous?.hits ?? 0,
|
|
88
|
+
};
|
|
89
|
+
const keys = Object.keys(cache.entries);
|
|
90
|
+
if (keys.length > MAX_ENTRIES) {
|
|
91
|
+
keys
|
|
92
|
+
.sort((a, b) => cache.entries[a].updatedAt - cache.entries[b].updatedAt)
|
|
93
|
+
.slice(0, keys.length - MAX_ENTRIES)
|
|
94
|
+
.forEach((stale) => delete cache.entries[stale]);
|
|
95
|
+
}
|
|
96
|
+
await writeCache(cache);
|
|
97
|
+
}
|
|
98
|
+
/** 清空缓存,供显式刷新或多份副本排查时使用。 */
|
|
99
|
+
export async function clearUploadCache() {
|
|
100
|
+
const cache = await readCache();
|
|
101
|
+
const count = Object.keys(cache.entries).length;
|
|
102
|
+
await writeCache({ version: CACHE_VERSION, entries: {} });
|
|
103
|
+
return count;
|
|
104
|
+
}
|
|
@@ -930,12 +930,14 @@ const candidateImportApply = {
|
|
|
930
930
|
// ⑥ 产物链接:人才卡片单页 + 人才库列表定位(自用系统追加 recruitType=useSelf)
|
|
931
931
|
const baseUrl = session.baseUrl.replace(/\/+$/, '');
|
|
932
932
|
const extra = String(cache.selfUse) === '1' ? '&recruitType=useSelf' : '';
|
|
933
|
+
const talentObjId = String(cache.forms?.talent_pool?.objId || cache.forms?.talent?.objId || '');
|
|
933
934
|
const talentCardUrl = cache.ebdDetailPageId
|
|
934
935
|
? `${baseUrl}/sp/ebdpage/view/${cache.ebdDetailPageId}?talentId=${talentId}${extra}`
|
|
935
|
-
: null;
|
|
936
|
+
: (talentObjId ? `${baseUrl}/sp/ebdfpage/card/0/${talentObjId}/${talentId}` : null);
|
|
936
937
|
const talentListId = cache.lists.talent?.listId;
|
|
938
|
+
// 列表只打开列表(2026-11-06 用户定稿);人才卡片单页由 talentCardUrl 单独给出。
|
|
937
939
|
const talentListLocateUrl = talentListId
|
|
938
|
-
? `${baseUrl}/sp/ebdfpage/list/${talentListId}
|
|
940
|
+
? `${baseUrl}/sp/ebdfpage/list/${talentListId}`
|
|
939
941
|
: null;
|
|
940
942
|
const warnings = [...(payload.warnings || [])];
|
|
941
943
|
if (batchNote)
|
|
@@ -19,8 +19,9 @@ import { getDsOptions, getFormDataRecord, resolvePersonId, saveFormData, toSubmi
|
|
|
19
19
|
* - 招聘人数 recruit_count=1、薪酬月份数 number_of_pay_months=12
|
|
20
20
|
* - 薪酬类型 salary_type=月薪、招聘方式 recruit_type=社会招聘(ds/options)
|
|
21
21
|
* - 招聘负责人 / 用人经理 = 当前登录用户
|
|
22
|
-
* -
|
|
22
|
+
* - 职位属性/序列/学历/工作年限/薪酬上下限/招聘流程 = **取环境内已有职位记录的值**
|
|
23
23
|
* ("默认值 = 系统现成值",保证引用有效;取不到则跳过并在摘要中标注)
|
|
24
|
+
* - 工作地点 work_location = 「办公地点」列表里启用状态的默认详细地址(**不参与继承**,id 运行时解析)
|
|
24
25
|
*/
|
|
25
26
|
const TEXT_KEYS = ['position_name'];
|
|
26
27
|
const MTEXT_KEYS = ['position_duty', 'work_request'];
|
|
@@ -35,11 +36,14 @@ const REF_COPY_KEYS = [
|
|
|
35
36
|
'job_category',
|
|
36
37
|
'education',
|
|
37
38
|
'work_years',
|
|
38
|
-
'work_location',
|
|
39
39
|
'salary_min',
|
|
40
40
|
'salary_max',
|
|
41
41
|
'recruit_flow',
|
|
42
42
|
];
|
|
43
|
+
// 默认办公地点用详细地址名称声明,不写死记录 id:运行时到「办公地点」列表按「启用」状态精确解析。
|
|
44
|
+
// work_location 已从 REF_COPY_KEYS 移除——继承会把 detail_location 为「1」的脏地点带进新职位
|
|
45
|
+
// (2026-11-06 真机实测)。
|
|
46
|
+
const DEFAULT_WORK_LOCATION = '浦江镇三鲁公路3419号泛微软件园';
|
|
43
47
|
const TEXT_DEFAULTS = { recruit_count: '1', number_of_pay_months: '12' };
|
|
44
48
|
const OPTION_DEFAULTS = { salary_type: '月薪', recruit_type: '社会招聘', status: '招聘中' };
|
|
45
49
|
/** 显式入参 → 职位字段 dataKey 与取值类别(逐字段声明,避免用通用 payload 包裹)。 */
|
|
@@ -139,14 +143,34 @@ async function findWorkPlaceMenu(env, cache) {
|
|
|
139
143
|
return null;
|
|
140
144
|
}
|
|
141
145
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
146
|
+
// 仅进程内 memo(不落盘):记录 id 与「启用」状态 optionId 一律运行时从列表解析。
|
|
147
|
+
const workPlaceMemo = new Map();
|
|
148
|
+
function stripHtml(s) {
|
|
149
|
+
return String(s ?? '').replace(/<[^>]*>/g, '').trim();
|
|
150
|
+
}
|
|
151
|
+
function parseSpans(raw) {
|
|
152
|
+
try {
|
|
153
|
+
const v = Array.isArray(raw) ? raw : JSON.parse(String(raw || '[]'));
|
|
154
|
+
return Array.isArray(v) ? v : [];
|
|
155
|
+
}
|
|
156
|
+
catch {
|
|
157
|
+
return [];
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/** 「启用」判定只看服务端翻译文本,不写死 optionId(跨环境会变)。 */
|
|
161
|
+
function isEnabledText(s) {
|
|
162
|
+
const t = stripHtml(s);
|
|
163
|
+
return t.includes('启用') && !t.includes('禁用');
|
|
164
|
+
}
|
|
165
|
+
/** 拉取「办公地点」列表并按 place_status=启用 过滤;状态信息缺失时不过滤并依赖精确地址匹配。 */
|
|
166
|
+
async function loadWorkPlaces(env, cache) {
|
|
147
167
|
const menu = await findWorkPlaceMenu(env, cache);
|
|
148
168
|
if (!menu?.listId)
|
|
149
|
-
return
|
|
169
|
+
return [];
|
|
170
|
+
const key = String(cache.appId || '') + '|' + menu.listId;
|
|
171
|
+
const cached = workPlaceMemo.get(key);
|
|
172
|
+
if (cached)
|
|
173
|
+
return cached;
|
|
150
174
|
let pObj = '';
|
|
151
175
|
try {
|
|
152
176
|
const t = (await env.host.request({
|
|
@@ -157,33 +181,84 @@ async function resolveWorkLocation(env, cache, value) {
|
|
|
157
181
|
if (Array.isArray(d) && d[0])
|
|
158
182
|
pObj = String(d[0].id || '');
|
|
159
183
|
}
|
|
160
|
-
catch {
|
|
161
|
-
/* tag 未注册:用菜单节点兜底 */
|
|
162
|
-
}
|
|
184
|
+
catch { /* tag 未注册:用菜单节点兜底 */ }
|
|
163
185
|
if (!pObj)
|
|
164
186
|
pObj = String(menu.objId || '');
|
|
165
187
|
if (!pObj)
|
|
188
|
+
return [];
|
|
189
|
+
const pageSize = 200;
|
|
190
|
+
const rawRows = [];
|
|
191
|
+
const dispRows = [];
|
|
192
|
+
for (let page = 1; page <= 5; page++) {
|
|
193
|
+
const body = buildListBody({
|
|
194
|
+
listId: menu.listId,
|
|
195
|
+
cusMenuId: menu.cusMenuId,
|
|
196
|
+
menuName: menu.menuName || '办公地点',
|
|
197
|
+
title: menu.menuName || '办公地点',
|
|
198
|
+
current: page,
|
|
199
|
+
pageSize,
|
|
200
|
+
});
|
|
201
|
+
const r = (await env.host.request({
|
|
202
|
+
path: `/api/ebuilder/form/list/getListDatas?passid=${pObj}&cid=${pObj}`,
|
|
203
|
+
body,
|
|
204
|
+
headers: { ebBusinessId: menu.listId },
|
|
205
|
+
}));
|
|
206
|
+
const batch = (r?.data?.data || r?.data?.displayData || []);
|
|
207
|
+
rawRows.push(...batch);
|
|
208
|
+
dispRows.push(...(r?.data?.displayData || []));
|
|
209
|
+
if (batch.length < pageSize)
|
|
210
|
+
break; // 服务端 total/hasMore 不可信,唯一可靠判据是分页本身
|
|
211
|
+
}
|
|
212
|
+
const enabledStatusIds = new Set();
|
|
213
|
+
const enabledRowIds = new Set();
|
|
214
|
+
for (const d of dispRows) {
|
|
215
|
+
const rid = String(d?.form_data_id || d?.id || '');
|
|
216
|
+
if (isEnabledText(d?.place_status) && rid)
|
|
217
|
+
enabledRowIds.add(rid);
|
|
218
|
+
for (const s of parseSpans(d?.place_statusSpan)) {
|
|
219
|
+
if (isEnabledText(s?.name) && s?.id)
|
|
220
|
+
enabledStatusIds.add(String(s.id));
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
const statusFiltered = enabledRowIds.size > 0 || enabledStatusIds.size > 0;
|
|
224
|
+
const rows = rawRows
|
|
225
|
+
.filter((x) => !statusFiltered
|
|
226
|
+
|| enabledRowIds.has(String(x?.form_data_id || x?.id || ''))
|
|
227
|
+
|| enabledStatusIds.has(String(x?.place_status || '')))
|
|
228
|
+
.map((x) => ({
|
|
229
|
+
id: String(x?.form_data_id || x?.id || ''),
|
|
230
|
+
name: String(x?.name || ''),
|
|
231
|
+
detail: String(x?.detail_location || ''),
|
|
232
|
+
area: String(x?.area_text || ''),
|
|
233
|
+
}))
|
|
234
|
+
.filter((x) => !!x.id);
|
|
235
|
+
workPlaceMemo.set(key, rows);
|
|
236
|
+
return rows;
|
|
237
|
+
}
|
|
238
|
+
/** 精确匹配优先;包含匹配要求地址文本足够长且非纯数字,避免把内容写成「1」的脏地点选中。 */
|
|
239
|
+
function matchWorkPlace(rows, value) {
|
|
240
|
+
const v = String(value).trim();
|
|
241
|
+
if (!v || !rows.length)
|
|
242
|
+
return null;
|
|
243
|
+
const exact = rows.find((r) => r.detail === v) || rows.find((r) => r.name === v);
|
|
244
|
+
if (exact)
|
|
245
|
+
return exact;
|
|
246
|
+
const valid = (s) => s.length >= 4 && !/^\d+$/.test(s);
|
|
247
|
+
return rows.find((r) => (r.detail.includes(v) && valid(r.detail))
|
|
248
|
+
|| (r.name.includes(v) && valid(r.name))
|
|
249
|
+
|| (r.area.includes(v) && valid(r.area))
|
|
250
|
+
|| (v.includes(r.detail) && valid(r.detail))) || null;
|
|
251
|
+
}
|
|
252
|
+
/** 工作地点:按名称/详细地址/区域文本解析「办公地点」记录 id(只匹配启用记录);解析不到返回 null,不臆造 id。 */
|
|
253
|
+
async function resolveWorkLocation(env, cache, value) {
|
|
254
|
+
if (!String(value).trim())
|
|
166
255
|
return null;
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
});
|
|
174
|
-
const r = (await env.host.request({
|
|
175
|
-
path: `/api/ebuilder/form/list/getListDatas?passid=${pObj}&cid=${pObj}`,
|
|
176
|
-
body,
|
|
177
|
-
headers: { ebBusinessId: menu.listId },
|
|
178
|
-
}));
|
|
179
|
-
const rows = (r?.data?.data || r?.data?.displayData || []);
|
|
180
|
-
const hit = rows.find((x) => {
|
|
181
|
-
const name = String(x?.name || '');
|
|
182
|
-
const detail = String(x?.detail_location || '');
|
|
183
|
-
const area = String(x?.area_text || '');
|
|
184
|
-
return name.includes(v) || detail.includes(v) || area.includes(v) || (!!detail && v.includes(detail));
|
|
185
|
-
});
|
|
186
|
-
return hit ? { id: String(hit.form_data_id || hit.id), name: String(hit.detail_location || hit.name || v) } : null;
|
|
256
|
+
const hit = matchWorkPlace(await loadWorkPlaces(env, cache), value);
|
|
257
|
+
return hit ? { id: hit.id, name: hit.detail || hit.name || String(value) } : null;
|
|
258
|
+
}
|
|
259
|
+
/** 默认办公地点:按详细地址在启用列表中精确解析 id,解析不到返回 null(不写、不继承)。 */
|
|
260
|
+
async function resolveDefaultWorkLocation(env, cache) {
|
|
261
|
+
return resolveWorkLocation(env, cache, DEFAULT_WORK_LOCATION);
|
|
187
262
|
}
|
|
188
263
|
/** 从提交 detail 取可读值(用于 summary 里点名「继承来的值」) */
|
|
189
264
|
function detailDisplayValue(detail) {
|
|
@@ -261,7 +336,16 @@ async function buildPositionPlan(env, cache, args) {
|
|
|
261
336
|
continue;
|
|
262
337
|
}
|
|
263
338
|
if (field.kind === 'text' || field.kind === 'number') {
|
|
264
|
-
|
|
339
|
+
// 薪资单位是千元(页面 15.00 = 15K);显式入参按「元」传,换算后再写;继承值不在此路径。
|
|
340
|
+
let out = String(value);
|
|
341
|
+
if (field.key === 'salary_min' || field.key === 'salary_max') {
|
|
342
|
+
const n = Number(String(value).replace(/,/g, ''));
|
|
343
|
+
if (Number.isFinite(n) && n > 0) {
|
|
344
|
+
const k = n / 1000;
|
|
345
|
+
out = String(Number.isInteger(k) ? k : Number(k.toFixed(3)));
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
put({ formField: { id: fieldId }, content: out });
|
|
265
349
|
applied.push(`${field.key}=${value}`);
|
|
266
350
|
}
|
|
267
351
|
else if (field.kind === 'option') {
|
|
@@ -348,6 +432,20 @@ async function buildPositionPlan(env, cache, args) {
|
|
|
348
432
|
missingRef.push(key);
|
|
349
433
|
}
|
|
350
434
|
}
|
|
435
|
+
// ⑥ 工作地点默认值:不再从在册职位继承(实测会带出 detail_location 为「1」的脏地点),
|
|
436
|
+
// 改为在「办公地点」列表按启用状态 + 详细地址精确解析;解析不到则不写并点名。
|
|
437
|
+
let workLocationDefault = null;
|
|
438
|
+
let workLocationWarning = null;
|
|
439
|
+
if (!has('work_location') && fid('work_location')) {
|
|
440
|
+
const loc = await resolveDefaultWorkLocation(env, cache).catch(() => null);
|
|
441
|
+
if (loc) {
|
|
442
|
+
put({ formField: { id: fid('work_location') }, dataOptions: [{ optionId: loc.id, content: loc.name }] });
|
|
443
|
+
workLocationDefault = loc.name;
|
|
444
|
+
}
|
|
445
|
+
else {
|
|
446
|
+
workLocationWarning = `未在「办公地点」列表找到启用状态的默认地点「${DEFAULT_WORK_LOCATION}」,本次不写 work_location;请用 workLocation 显式指定`;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
351
449
|
const inverse = {};
|
|
352
450
|
for (const [dataKey, fieldId] of Object.entries(fields))
|
|
353
451
|
inverse[String(fieldId)] = dataKey;
|
|
@@ -376,12 +474,14 @@ async function buildPositionPlan(env, cache, args) {
|
|
|
376
474
|
explicitApplied: applied,
|
|
377
475
|
explicitSkipped: skipped,
|
|
378
476
|
inheritedFromExistingPosition: inherited,
|
|
379
|
-
// 带值的继承清单:Agent
|
|
380
|
-
//
|
|
477
|
+
// 带值的继承清单:Agent 必须在确认摘要里逐项点名,不得因为它是默认值就略过
|
|
478
|
+
// (工作地点不参与继承,已改为启用办公地点列表精确解析)。
|
|
381
479
|
inheritedFromRef: inherited.length
|
|
382
480
|
? inherited.map((k) => ({ field: k, value: detailDisplayValue(refMap.get(String(fid(k)))) }))
|
|
383
481
|
: undefined,
|
|
384
482
|
inheritedSalaryWarnings: inheritedSalaryWarnings.length ? inheritedSalaryWarnings : undefined,
|
|
483
|
+
workLocationDefault: workLocationDefault || undefined,
|
|
484
|
+
workLocationWarning: workLocationWarning || undefined,
|
|
385
485
|
noReferenceValue: missingRef,
|
|
386
486
|
principalDefault: session.userId ? '当前登录用户' : '未解析到当前用户',
|
|
387
487
|
},
|
|
@@ -475,8 +575,9 @@ const positionCreateApply = {
|
|
|
475
575
|
const list = cache.lists.position;
|
|
476
576
|
const baseUrl = session.baseUrl.replace(/\/+$/, '');
|
|
477
577
|
const cardUrl = `${baseUrl}/sp/ebdfpage/card/0/${payload.objId}/${formDataId}`;
|
|
578
|
+
// 列表只打开列表(2026-11-06 用户定稿);详情单页由 cardUrl 单独给出,不再用「列表+滑出详情」组合地址。
|
|
478
579
|
const listLocateUrl = list?.listId
|
|
479
|
-
? `${baseUrl}/sp/ebdfpage/list/${list.listId}
|
|
580
|
+
? `${baseUrl}/sp/ebdfpage/list/${list.listId}`
|
|
480
581
|
: null;
|
|
481
582
|
if (!created) {
|
|
482
583
|
throw ehrValidationError('position_create_failed', `职位表单已保存(formDataId=${formDataId}),但 addPosition 未返回职位 id:${response?.msg || '未知原因'};请到职位管理核对后再决定是否重试`);
|
|
@@ -29,29 +29,28 @@ async function requireRecruitCache(env) {
|
|
|
29
29
|
return env.recruitContext.load(env.host);
|
|
30
30
|
}
|
|
31
31
|
// ── 产物链接(2026-10-29 周军锋要求:写操作完成后自动生成链接返回对话框)──
|
|
32
|
-
// URL 模板与 recruit-stage
|
|
33
|
-
//
|
|
34
|
-
//
|
|
32
|
+
// URL 模板与 recruit-stage 同源:详情单页 /sp/ebdpage/view/{ebdDetailPageId}?talentId=(实证)或 /sp/ebdfpage/card/0/{objId}/{dataId};
|
|
33
|
+
// 列表 /sp/ebdfpage/list/{listId} —— **只打开列表**(2026-11-06 用户定稿)。
|
|
34
|
+
// 停用旧「列表 + 滑出详情」形态 .../list/{listId}/card/0/{objId}/{dataId}/...:它会在打开列表时一同打开记录详情单页。
|
|
35
|
+
// 详情与列表由两个独立链接分别给出;listId 取环境缓存,id 缺失返回 null 不编造。
|
|
35
36
|
function recruitTalentCardUrl(cache, baseUrl, talentId) {
|
|
36
|
-
if (!
|
|
37
|
-
return null;
|
|
38
|
-
const extra = String(cache.selfUse) === "1" ? "&recruitType=useSelf" : "";
|
|
39
|
-
return `${baseUrl.replace(/\/+$/, "")}/sp/ebdpage/view/${cache.ebdDetailPageId}?talentId=${talentId}${extra}`;
|
|
40
|
-
}
|
|
41
|
-
function recruitSlideLocateUrl(cache, baseUrl, listKey, formKey, dataId) {
|
|
42
|
-
const listId = cache.lists?.[listKey]?.listId;
|
|
43
|
-
const objId = cache.forms?.[formKey]?.objId;
|
|
44
|
-
if (!listId || !objId || !dataId || !cache.appId)
|
|
37
|
+
if (!talentId)
|
|
45
38
|
return null;
|
|
46
39
|
const base = baseUrl.replace(/\/+$/, "");
|
|
47
|
-
|
|
40
|
+
if (cache.ebdDetailPageId) {
|
|
41
|
+
const extra = String(cache.selfUse) === "1" ? "&recruitType=useSelf" : "";
|
|
42
|
+
return `${base}/sp/ebdpage/view/${cache.ebdDetailPageId}?talentId=${talentId}${extra}`;
|
|
43
|
+
}
|
|
44
|
+
// 缓存缺页面 id 时退化为 EB 卡片单页,objId 运行时解析,禁止返回 null
|
|
45
|
+
const objId = String(cache.forms?.talent_pool?.objId || cache.forms?.talent?.objId || "");
|
|
46
|
+
return objId ? `${base}/sp/ebdfpage/card/0/${objId}/${talentId}` : null;
|
|
48
47
|
}
|
|
49
|
-
|
|
48
|
+
/** 只打开列表页:不带 /card/... 段、不带记录 id query,避免一同滑出详情单页。 */
|
|
49
|
+
function recruitOpenListUrl(cache, baseUrl, listKey) {
|
|
50
50
|
const menu = cache.lists?.[listKey];
|
|
51
51
|
if (!menu?.listId)
|
|
52
52
|
return null;
|
|
53
|
-
|
|
54
|
-
return `${baseUrl.replace(/\/+$/, "")}/sp/ebdfpage/list/${menu.listId}${extra}`;
|
|
53
|
+
return `${baseUrl.replace(/\/+$/, "")}/sp/ebdfpage/list/${menu.listId}`;
|
|
55
54
|
}
|
|
56
55
|
/** 建前查重:按手机号搜人才库(total 恒 0 平台缺陷,以 data.data[] 非空为准)。 */
|
|
57
56
|
export async function checkDuplicateByMobile(env, cache, mobile) {
|
|
@@ -534,7 +533,7 @@ const candidateCreateApply = {
|
|
|
534
533
|
initTalentBatch: initMsg,
|
|
535
534
|
searchHint: `可用 ehr.recruit.candidate.search 按 name=${name} 或 mobile=${mobile} 回查`,
|
|
536
535
|
talentCardUrl: recruitTalentCardUrl(cache, lease.baseUrl, newId),
|
|
537
|
-
talentListLocateUrl: recruitOpenListUrl(cache, lease.baseUrl, 'talent'
|
|
536
|
+
talentListLocateUrl: recruitOpenListUrl(cache, lease.baseUrl, 'talent'),
|
|
538
537
|
});
|
|
539
538
|
},
|
|
540
539
|
};
|
|
@@ -986,7 +985,7 @@ const interviewArrangeApply = {
|
|
|
986
985
|
time: plan.interviewTime,
|
|
987
986
|
interviewer: plan.interviewer,
|
|
988
987
|
talentCardUrl: recruitTalentCardUrl(cache, lease.baseUrl, args.talentId),
|
|
989
|
-
interviewLocateUrl:
|
|
988
|
+
interviewLocateUrl: recruitOpenListUrl(cache, lease.baseUrl, 'interview'),
|
|
990
989
|
});
|
|
991
990
|
},
|
|
992
991
|
};
|
|
@@ -16,7 +16,7 @@ import { compact, normalizePaged, toNumber, toPageQuery, toPositiveInt } from '.
|
|
|
16
16
|
const RECRUIT_APP_TAG = 'weaver-recruit-service';
|
|
17
17
|
/** 逻辑名 -> objTag(权威映射,与 _init_env_cache.mjs 一致) */
|
|
18
18
|
/** 环境缓存结构版本:新增/变更解析字段(如 2026-11-04 补 candidate 应聘者列表)时 +1,旧缓存自动失效重建。 */
|
|
19
|
-
const RECRUIT_CACHE_VERSION =
|
|
19
|
+
const RECRUIT_CACHE_VERSION = 3;
|
|
20
20
|
const RECRUIT_TAGS = {
|
|
21
21
|
talent_pool: 'uf_rcrt_talent_pool',
|
|
22
22
|
interview_plan: 'uf_rcrt_interview_plan',
|
|
@@ -142,22 +142,34 @@ async function fetchFormFields(host, appId, objId) {
|
|
|
142
142
|
const fieldId = String(field?.id || '');
|
|
143
143
|
if (dataKey && fieldId)
|
|
144
144
|
fmap[dataKey] = fieldId;
|
|
145
|
-
|
|
145
|
+
// 🔴 选项映射只针对「值固定」的选择类字段(单选 Select / 开关 Switch)。
|
|
146
|
+
// 关联浏览字段(本环境实测 type=String,如职位 education / job_category / position_nature /
|
|
147
|
+
// work_location、面试 digital_id)config.options 为空,值来自另一张表的记录 id,跨环境必变;
|
|
148
|
+
// 级联 Cascader 同理。**一律不进缓存**,走运行时 browser/字典解析,禁止写死或固化。
|
|
149
|
+
const selectLike = field?.type === 'Select' || field?.type === 'Switch';
|
|
150
|
+
if (selectLike && fieldId && Array.isArray(config.options) && config.options.length) {
|
|
146
151
|
const map = {};
|
|
147
152
|
for (const option of config.options) {
|
|
148
153
|
if (!option || typeof option !== 'object')
|
|
149
154
|
continue;
|
|
150
155
|
const name = option.name;
|
|
151
|
-
|
|
156
|
+
// 🔴 可写值(写进 saveFormData 的 optionId)= value / valueKey,**不是** selectionId。
|
|
157
|
+
// 实测(2026-11-06,www.e-cology.com.cn,均为 Select 字段):两者绝大多数相同,个别选项不同,例:
|
|
158
|
+
// 面试方式「AI面试」selectionId=1274947951008702504(写不进去,后端静默丢弃),
|
|
159
|
+
// valueKey=841052191228968964(正确,与 ds/options 一致);
|
|
160
|
+
// 人才最高学历「博士」selectionId=1073374587183710218,valueKey=0(正确,与 ds/options 一致)。
|
|
161
|
+
// 优先级:value → valueKey → extra.valueKey/value → selectionId/id(旧环境兜底)。
|
|
162
|
+
const scalar = (v) => (typeof v === 'string' || typeof v === 'number') && String(v) !== '' ? String(v) : '';
|
|
163
|
+
let selectionId = scalar(option.value) || scalar(option.valueKey);
|
|
152
164
|
if (!selectionId && typeof option.extra === 'string') {
|
|
153
165
|
try {
|
|
154
166
|
const extra = JSON.parse(option.extra);
|
|
155
|
-
selectionId = extra.
|
|
167
|
+
selectionId = scalar(extra.valueKey) || scalar(extra.value);
|
|
156
168
|
}
|
|
157
169
|
catch { /* 坏 extra 回退 */ }
|
|
158
170
|
}
|
|
159
171
|
if (!selectionId)
|
|
160
|
-
selectionId = option.
|
|
172
|
+
selectionId = scalar(option.selectionId) || scalar(option.id);
|
|
161
173
|
if (selectionId && name)
|
|
162
174
|
map[String(selectionId)] = name;
|
|
163
175
|
}
|
|
@@ -172,6 +172,9 @@ function resolveEmployeeCondition(args) {
|
|
|
172
172
|
return { field: explicit, value: String(args[explicit]).trim() };
|
|
173
173
|
const keyword = args.keyword === undefined ? '' : String(args.keyword).trim();
|
|
174
174
|
if (!keyword) {
|
|
175
|
+
// all:true 拉全员(分页/目录缓存用),不需要收敛条件(2026-11-06)
|
|
176
|
+
if (args.all === true)
|
|
177
|
+
return { field: '', value: '' };
|
|
175
178
|
throw hrmValidationError('empty_condition', '员工查询必须携带至少一个收敛条件:keyword(自动推断)或 username/job_num/mobile/email 之一');
|
|
176
179
|
}
|
|
177
180
|
const inferred = inferEmployeeField(keyword);
|
|
@@ -202,6 +205,7 @@ const employeeQuery = {
|
|
|
202
205
|
email: { type: 'string', description: '邮箱(模糊匹配)' },
|
|
203
206
|
status: { type: 'array', items: { type: 'string', enum: [...EMPLOYEE_STATUS] }, description: '默认 ["normal"] 在职;["6"] 离职。不能单独作为收敛条件' },
|
|
204
207
|
full: { type: 'boolean', description: '默认 false:每行只回人员信息(id/name/department/position/statusCode/link);true:回完整行(另含 userid/cid/mobile/departmentId/deptLink)' },
|
|
208
|
+
all: { type: 'boolean', description: 'true = 自动翻页拉全量(最多 50 页);结果多时建议直接传,避免只拿到第一页' },
|
|
205
209
|
...SCHEMA_PAGE,
|
|
206
210
|
}),
|
|
207
211
|
handler: async (args, { host }) => {
|
|
@@ -217,7 +221,7 @@ const employeeQuery = {
|
|
|
217
221
|
const formDatas = {
|
|
218
222
|
...memberFormDatasBase(),
|
|
219
223
|
status: [{ statusSelect: statusText }],
|
|
220
|
-
[field]: [{ [`${field}Opt`]: 'in', [`${field}Input`]: value }],
|
|
224
|
+
...(field !== '' ? { [field]: [{ [`${field}Opt`]: 'in', [`${field}Input`]: value }] } : {}),
|
|
221
225
|
};
|
|
222
226
|
const body = {
|
|
223
227
|
...browserBaseBody(),
|
|
@@ -236,6 +240,30 @@ const employeeQuery = {
|
|
|
236
240
|
if (pageSize !== undefined)
|
|
237
241
|
body.pageSize = pageSize;
|
|
238
242
|
const session = await host.getSession();
|
|
243
|
+
// all:true → 自动翻页拉全量(2026-11-06 用户要求:所有分页都能翻,别只给第一页)
|
|
244
|
+
if (args.all === true) {
|
|
245
|
+
const collected = [];
|
|
246
|
+
let pages = 0;
|
|
247
|
+
const size = pageSize ?? 100;
|
|
248
|
+
for (let p = 1; p <= 200; p += 1) { // 上限 200 页(本租户约 5000 人,100/页 → 50 页,留足余量)
|
|
249
|
+
const resp = await host.request({
|
|
250
|
+
method: 'POST',
|
|
251
|
+
path: '/api/hrm/common/browser/data/resource',
|
|
252
|
+
body: { ...body, current: p, pageSize: size },
|
|
253
|
+
});
|
|
254
|
+
const pageRows = resp?.data?.data ?? [];
|
|
255
|
+
pages = p;
|
|
256
|
+
if (pageRows.length === 0)
|
|
257
|
+
break;
|
|
258
|
+
collected.push(...pageRows);
|
|
259
|
+
if (pageRows.length < size)
|
|
260
|
+
break;
|
|
261
|
+
}
|
|
262
|
+
const allSession = await host.getSession();
|
|
263
|
+
const allBaseUrl = String(allSession.baseUrl ?? '').replace(/\/+$/g, '');
|
|
264
|
+
const allRows = collected.map((r) => (args.full === true ? formatMember(r, allBaseUrl) : formatQueryRowBrief(r, allBaseUrl)));
|
|
265
|
+
return hrmSuccess('hrm.employee.query', { rows: allRows, total: allRows.length, pagesFetched: pages, all: true }, { current: 1, pageSize: allRows.length });
|
|
266
|
+
}
|
|
239
267
|
const baseUrl = session.baseUrl.replace(/\/+$/, '');
|
|
240
268
|
// 不请求 count 接口(省一次 HTTP 往返);data 接口的 count 字段不可靠(恒 0),
|
|
241
269
|
// 用返回行数作为 total。收敛条件查询结果通常 < pageSize,行数即总数。
|