weaver-work-cli 0.1.47 → 0.1.48
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-oa-BBDP7AKJ.js → archive-oa-EDJDU3V4.js} +454 -5
- package/dist/chunks/{attachment-content-MCXQBD6N.js → attachment-content-4KSNBPRO.js} +3 -3
- package/dist/chunks/{chunk-J2VEB5K3.js → chunk-2BQESR2U.js} +2 -2
- package/dist/chunks/{chunk-727FH2NI.js → chunk-2IGZUMNG.js} +15 -2
- package/dist/chunks/{chunk-76H3IKH6.js → chunk-5B5JXTY2.js} +35 -35
- package/dist/chunks/{chunk-Q4OYAQYH.js → chunk-72MI3MBX.js} +4 -0
- package/dist/chunks/{chunk-4RWS2YYL.js → chunk-BCACE6VV.js} +2 -2
- package/dist/chunks/{chunk-AD46OMQK.js → chunk-EFOUMXIX.js} +119 -44
- package/dist/chunks/{chunk-IRMIEDXN.js → chunk-FEP6ELMR.js} +1 -1
- package/dist/chunks/{chunk-LIEQJIGM.js → chunk-GR76ZDDX.js} +0 -3
- package/dist/chunks/{chunk-JB34OE7R.js → chunk-NBEWUR7L.js} +1 -1
- package/dist/chunks/{chunk-6V5ZPKHV.js → chunk-NK74RE5F.js} +2 -2
- package/dist/chunks/{chunk-GSZTA43P.js → chunk-OCYRVZGN.js} +2 -2
- package/dist/chunks/{chunk-OXHHJWNC.js → chunk-PSPOFLSU.js} +1 -1
- package/dist/chunks/{chunk-6AXKWFKG.js → chunk-R2HHLJNN.js} +4 -4
- package/dist/chunks/{chunk-PSOMGA3U.js → chunk-SVFG6EMV.js} +35 -6
- package/dist/chunks/{chunk-IP4CWQCF.js → chunk-WMSAWAWZ.js} +8 -8
- package/dist/chunks/{conflict-H7EHQXYY.js → conflict-APGSD5E7.js} +2 -2
- package/dist/chunks/{contract-3QLAGYQL.js → contract-N6P2HIIE.js} +425 -187
- package/dist/chunks/{create-flow-VRVJEOBX.js → create-flow-5TXFOC7X.js} +6 -6
- package/dist/chunks/{ehr-SH2LM3NK.js → ehr-XI4BIVR2.js} +16 -5
- package/dist/chunks/{env-66FPSJDV.js → env-B6GKA2J3.js} +2 -2
- package/dist/chunks/{factory-UH2TZBVA.js → factory-MFCKLUT6.js} +1 -1
- package/dist/chunks/{group-chat-CAKMMV7K.js → group-chat-YE7WIBFO.js} +3 -3
- package/dist/chunks/{im-NJB7ZYMH.js → im-3RCNL5GT.js} +107 -1
- package/dist/chunks/{invoice-UEAHSYAE.js → invoice-FXWH5GPO.js} +2 -71
- package/dist/chunks/{lazy-dispatch-25XGTXLM.js → lazy-dispatch-XSAHDK6Z.js} +3 -3
- package/dist/chunks/{meeting-VTBFW4HI.js → meeting-RYZV2JTQ.js} +10 -10
- package/dist/chunks/{reception-5WITA44R.js → reception-VL6TKVAW.js} +480 -26
- package/dist/chunks/{recruit-stage-CAKZTUA7.js → recruit-stage-ERZD3ZNB.js} +52 -16
- package/dist/chunks/{registry-JVQBLFQ5.js → registry-22O6UG4I.js} +10 -10
- package/dist/chunks/{registry-AQVGHUM6.js → registry-7VZ6YJUF.js} +2 -2
- package/dist/chunks/{registry-PVUZQDDQ.js → registry-BUTEDK3C.js} +1 -1
- package/dist/chunks/{room-recommend-5U55FMXZ.js → room-recommend-IMZPJMYB.js} +4 -4
- package/dist/chunks/{schedule-IDETODCA.js → schedule-SPPAHER2.js} +4 -4
- package/dist/chunks/{workflow-BSYT5TGL.js → workflow-WVEFJ6KC.js} +2 -2
- package/dist/core/refs.js +19 -2
- package/dist/index.js +14 -14
- package/dist/shortcuts/archive-oa/constants.js +42 -0
- package/dist/shortcuts/archive-oa/host.js +2 -2
- package/dist/shortcuts/archive-oa/index.js +38 -0
- package/dist/shortcuts/archive-oa/operations/borrow-car.js +117 -3
- package/dist/shortcuts/archive-oa/operations/my-borrow-contract.js +271 -0
- package/dist/shortcuts/archive-oa/operations/registry.js +5 -3
- package/dist/shortcuts/contract/index.js +9 -1
- package/dist/shortcuts/contract/manifest.js +14 -2
- package/dist/shortcuts/contract/operations/card.js +231 -0
- package/dist/shortcuts/contract/operations/registry.js +2 -0
- package/dist/shortcuts/contract/operations/review.js +16 -5
- package/dist/shortcuts/contract/operations/summary.js +25 -17
- package/dist/shortcuts/ehr/operations/recruit-write.js +22 -5
- package/dist/shortcuts/ehr/recruit-stage/operations/interview-arrange.js +17 -8
- package/dist/shortcuts/ehr/recruit-stage/shared.js +33 -8
- package/dist/shortcuts/im/index.js +128 -0
- package/dist/shortcuts/im/operations/session.js +6 -0
- package/dist/shortcuts/invoice/host.js +0 -3
- package/dist/shortcuts/invoice/manifest.js +0 -1
- package/dist/shortcuts/invoice/operations/reim-subsidy.js +1 -71
- package/dist/shortcuts/meeting/operations/eb/conflict.js +26 -3
- package/dist/shortcuts/meeting/operations/eb/continuation-alias.js +63 -0
- package/dist/shortcuts/meeting/operations/eb/create-flow.js +71 -12
- package/dist/shortcuts/meeting/operations/eb/factory.js +5 -3
- package/dist/shortcuts/reception/host.js +33 -1
- package/dist/shortcuts/reception/index.js +19 -0
- package/dist/shortcuts/reception/manifest.js +53 -1
- package/dist/shortcuts/reception/operations/ask.js +18 -0
- package/dist/shortcuts/reception/operations/compose.js +113 -3
- package/dist/shortcuts/reception/operations/leads.js +245 -0
- package/dist/shortcuts/reception/operations/markdown.js +22 -0
- package/dist/shortcuts/reception/operations/registry.js +2 -0
- package/dist/shortcuts/reception/operations/render.js +36 -3
- package/dist/shortcuts/reception/operations/restaurant-rooms.js +118 -0
- package/dist/shortcuts/reception/operations/restaurant.js +251 -0
- package/dist/shortcuts/reception/operations/restaurantrooms.js +42 -0
- package/dist/shortcuts/reception/operations/schedule.js +7 -1
- package/dist/shortcuts/reception/upload.js +22 -6
- package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +17 -8
- package/dist/shortcuts/recruit-stage/shared.js +42 -14
- package/docs/archive-oa.md +4 -2
- package/package.json +1 -1
- package/skill-template/domains/archive-oa.md +2 -1
- package/skill-template/master-skill-template.md +1 -0
- package/skill-template/skill-template.md +1 -0
- package/skills/weaver-e10-archive-oa/SKILL.md +33 -6
- package/skills/weaver-e10-archive-oa/references/borrow-car.md +32 -7
- package/skills/weaver-e10-archive-oa/references/contract-search.md +32 -0
- package/skills/weaver-e10-archive-oa/references/disabled-capabilities.md +1 -1
- package/skills/weaver-e10-archive-oa/references/my-borrow-contract.md +97 -0
- package/skills/weaver-e10-archive-oa/references/my-borrow.md +6 -1
- package/skills/weaver-e10-archive-oa/references/qys-contract-search.md +22 -0
- package/skills/weaver-e10-calendar/SKILL.md +1 -1
- package/skills/weaver-e10-calendar/references/calendar-query.md +1 -1
- package/skills/weaver-e10-calendar/references/calendar-write.md +9 -9
- package/skills/weaver-e10-cowork/SKILL.md +9 -6
- package/skills/weaver-e10-jinchengda/SKILL.md +10 -7
- package/skills/weaver-e10-jinchengda/references/contract-action-card-template.html +17 -0
- package/skills/weaver-e10-jinchengda/references/contract-action-card.md +263 -35
- package/skills/weaver-e10-jinchengda/references/contract-action-engine.md +8 -5
- package/skills/weaver-e10-jinchengda/references/contract-ai-assistant.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +175 -22
- package/skills/weaver-e10-jinchengda/references/contract-command-index.md +2 -2
- package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +124 -19
- package/skills/weaver-e10-jinchengda/references/contract-element-extract.md +2 -2
- package/skills/weaver-e10-jinchengda/references/contract-execution-rules.md +4 -4
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +6 -0
- package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-risk-report-template.html +178 -0
- package/skills/weaver-e10-jinchengda/references/contract-template-recommend.md +1 -1
- package/skills/weaver-e10-jinchengda/references/orchestration.md +7 -7
- package/skills/weaver-e10-jinchengda/scripts/plan_actions.py +279 -0
- package/skills/weaver-e10-jinchengda/scripts/render_action_card.py +450 -0
- package/skills/weaver-e10-jinchengda/scripts/render_risk_report.py +358 -0
- package/skills/weaver-e10-jinchengda/scripts/validate_action_card.py +505 -0
- package/skills/weaver-e10-jucailin/SKILL.md +7 -4
- package/skills/weaver-e10-jucailin/references/recruit-create.md +3 -2
- package/skills/weaver-e10-jucailin/references/recruit-read.md +2 -1
- package/skills/weaver-e10-jucailin/references/recruit-stage-ops.md +3 -3
- package/skills/weaver-e10-jucailin/references/safety-boundaries.md +30 -2
- package/skills/weaver-e10-mail/SKILL.md +17 -4
- package/skills/weaver-e10-meeting/SKILL.md +94 -409
- package/skills/weaver-e10-meeting/references/create-flow.md +188 -0
- package/skills/weaver-e10-meeting/references/create-guardrails.md +234 -0
- package/skills/weaver-e10-meeting/references/pitfalls.md +40 -0
- package/skills/weaver-e10-reception-flow/SKILL.md +62 -18
- package/skills/weaver-e10-reception-flow/data/fields-snapshot.json +628 -26
- package/skills/weaver-e10-reception-flow/references/fields-snapshot.md +96 -26
- package/skills/weaver-e10-reception-flow/scripts/render.py +81 -2
- package/skills/weaver-e10-recruit-stage/SKILL.md +45 -12
- package/skills/weaver-e10-recruit-stage/agents/openai.yaml +58 -8
- package/skills/weaver-e10-recruit-stage/references/position-templates.md +5 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-edit-interview-feedback.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +40 -11
- package/skills/weaver-e10-recruit-stage/references/recruit-list-candidate.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-list-interview.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +16 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-parse.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-search-candidate.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-urge-feedback.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +127 -0
- package/skills/weaver-e10-shijingran/SKILL.md +6 -2
- package/skills/weaver-e10-shijingran/references/source-manifest.json +5 -4
- package/skills/weaver-e10-workflow/SKILL.md +1 -1
- package/skills/weaver-e10-yepiaotong/SKILL.md +8 -4
- package/skills/weaver-e10-yepiaotong/references/invoice-issuing-workflow.md +1 -1
- package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +1 -1
- package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +2 -2
- package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +1 -1
- package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +1 -1
- package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +1 -0
- package/skills/weaver-e10-yimiaoban/SKILL.md +2 -1
- package/skills/weaver-e10-yimiaoban/references/msg-write.md +32 -0
- package/skills/weaver-e10-yimiaoban/references/session-sysmsg.md +3 -0
- package/skills/weaver-e10-yimiaoban/references/source-manifest.json +11 -11
- package/dist/chunks/{ebuilder-form-GWDTKEI2.js → ebuilder-form-I5ZIX4WO.js} +3 -3
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-README.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-SKILL.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-openai.yaml +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-position-templates.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-arrange-interview.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-capability-check.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-check-install.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-detail-process.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-edit-interview-feedback.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-jd-create.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-jd-template.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-list-candidate.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-list-interview.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-match-candidates.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-output-links.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-resolve-creator.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-resolve-metadata.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-resume-import.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-resume-parse.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-search-candidate.md +0 -0
- /package/{skills → docs/legacy}/weaver-e10-jucailin/archive/LEGACY-recruit-urge-feedback.md +0 -0
|
@@ -122,6 +122,30 @@ function sectionHtml(section) {
|
|
|
122
122
|
return parts.join('');
|
|
123
123
|
}
|
|
124
124
|
const SECTION_TYPES = ['alert', 'reasons', 'grid', 'table', 'checks', 'list', 'next'];
|
|
125
|
+
/**
|
|
126
|
+
* 按固定模板把摘要数据渲染成完整 HTML。
|
|
127
|
+
* 抽成导出函数,供 contract.summary.render 与 contract.card.render(内嵌摘要)共用。
|
|
128
|
+
*/
|
|
129
|
+
export function renderSummaryHtml(data) {
|
|
130
|
+
const sections = asArray(data.sections);
|
|
131
|
+
if (sections.length === 0) {
|
|
132
|
+
throw contractValidationError('sections_required', '摘要数据必须包含非空的 sections 数组');
|
|
133
|
+
}
|
|
134
|
+
const unknownTypes = sections
|
|
135
|
+
.map((section) => String(section?.type ?? ''))
|
|
136
|
+
.filter((type) => !SECTION_TYPES.includes(type));
|
|
137
|
+
if (unknownTypes.length) {
|
|
138
|
+
throw contractValidationError('section_type_unknown', `未知的 section 类型:${[...new Set(unknownTypes)].join(', ')};支持 ${SECTION_TYPES.join(' / ')}`);
|
|
139
|
+
}
|
|
140
|
+
const badge = esc(data.badge ?? '合同');
|
|
141
|
+
const title = esc(data.title ?? '合同摘要');
|
|
142
|
+
const meta = esc(data.meta ?? '');
|
|
143
|
+
const body = sections.map((section) => sectionHtml(section)).join('');
|
|
144
|
+
return `<!DOCTYPE html><html lang="zh-CN"><head><meta charset="UTF-8">`
|
|
145
|
+
+ `<title>合同摘要 - ${title}</title><style>${CSS}</style></head><body><div class="w">`
|
|
146
|
+
+ `<div class="hd"><span class="bd">${badge}</span><h1>${title}</h1><div class="mt">${meta}</div></div>`
|
|
147
|
+
+ `${body}</div></body></html>`;
|
|
148
|
+
}
|
|
125
149
|
export const contractSummaryOperations = [
|
|
126
150
|
{
|
|
127
151
|
name: 'contract.summary.render',
|
|
@@ -142,23 +166,7 @@ export const contractSummaryOperations = [
|
|
|
142
166
|
throw contractValidationError('data_unreadable', `无法读取摘要数据 JSON:${message}`);
|
|
143
167
|
}
|
|
144
168
|
const sections = asArray(data.sections);
|
|
145
|
-
|
|
146
|
-
throw contractValidationError('sections_required', '摘要数据必须包含非空的 sections 数组');
|
|
147
|
-
}
|
|
148
|
-
const unknownTypes = sections
|
|
149
|
-
.map((section) => String(section?.type ?? ''))
|
|
150
|
-
.filter((type) => !SECTION_TYPES.includes(type));
|
|
151
|
-
if (unknownTypes.length) {
|
|
152
|
-
throw contractValidationError('section_type_unknown', `未知的 section 类型:${[...new Set(unknownTypes)].join(', ')};支持 ${SECTION_TYPES.join(' / ')}`);
|
|
153
|
-
}
|
|
154
|
-
const badge = esc(data.badge ?? '合同');
|
|
155
|
-
const title = esc(data.title ?? '合同摘要');
|
|
156
|
-
const meta = esc(data.meta ?? '');
|
|
157
|
-
const body = sections.map((section) => sectionHtml(section)).join('');
|
|
158
|
-
const html = `<!DOCTYPE html><html lang="zh-CN"><head><meta charset="UTF-8">`
|
|
159
|
-
+ `<title>合同摘要 - ${title}</title><style>${CSS}</style></head><body><div class="w">`
|
|
160
|
-
+ `<div class="hd"><span class="bd">${badge}</span><h1>${title}</h1><div class="mt">${meta}</div></div>`
|
|
161
|
-
+ `${body}</div></body></html>`;
|
|
169
|
+
const html = renderSummaryHtml(data);
|
|
162
170
|
writeFileSync(outPath, html, 'utf8');
|
|
163
171
|
const bytes = Buffer.byteLength(html, 'utf8');
|
|
164
172
|
return {
|
|
@@ -194,16 +194,29 @@ async function runEsb(host, objId, dataIds, esbActionIds) {
|
|
|
194
194
|
}
|
|
195
195
|
/** ds/options 运行时解析枚举(面试方式/轮次/结果等):name → optionId */
|
|
196
196
|
export async function getDsOptions(host, objId, fieldId, groupId) {
|
|
197
|
+
const { map } = await getDsOptionsFull(host, objId, fieldId, groupId);
|
|
198
|
+
return map;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* 全量版:map 排除 archive=1 的禁用项(实测 AI面试(小程序) 是唯一 archive:"1",选中会被后端
|
|
202
|
+
* 静默丢弃/落脏值),disabled 单独列出供「已禁用」精确报错。2026-11-09 实证。
|
|
203
|
+
*/
|
|
204
|
+
export async function getDsOptionsFull(host, objId, fieldId, groupId) {
|
|
197
205
|
const response = (await host.request({
|
|
198
206
|
path: '/api/ebuilder/common/ds/options',
|
|
199
207
|
query: { fieldName: fieldId, objId, sourceType: 'FORM', groupId },
|
|
200
208
|
}));
|
|
201
209
|
const map = {};
|
|
210
|
+
const disabled = [];
|
|
202
211
|
for (const option of response?.data || []) {
|
|
203
|
-
if (option?.name
|
|
212
|
+
if (!option?.name || !option?.id)
|
|
213
|
+
continue;
|
|
214
|
+
if (String(option.archive) === '1')
|
|
215
|
+
disabled.push({ name: String(option.name), id: String(option.id) });
|
|
216
|
+
else
|
|
204
217
|
map[option.name] = String(option.id);
|
|
205
218
|
}
|
|
206
|
-
return map;
|
|
219
|
+
return { map, disabled };
|
|
207
220
|
}
|
|
208
221
|
/**
|
|
209
222
|
* 人员名称 → userId。
|
|
@@ -827,10 +840,13 @@ async function buildInterviewPlan(env, cache, args) {
|
|
|
827
840
|
throw ehrValidationError('recruit_field_missing', `面试计划表单缺少字段 ${key}(环境缓存 ds/fields 未解析到,请重建环境缓存后重试)`);
|
|
828
841
|
}
|
|
829
842
|
}
|
|
830
|
-
const
|
|
831
|
-
const typeOptionId =
|
|
843
|
+
const typeFull = await getDsOptionsFull(host, objId, fieldIdOf('interview_type'), cache.appId);
|
|
844
|
+
const typeOptionId = typeFull.map[type];
|
|
832
845
|
if (!typeOptionId) {
|
|
833
|
-
|
|
846
|
+
if (typeFull.disabled.some((d) => d.name === type)) {
|
|
847
|
+
throw ehrValidationError('enum_disabled', `面试方式「${type}」已禁用(该枚举项 archive=1),请改用其它面试方式`);
|
|
848
|
+
}
|
|
849
|
+
throw ehrValidationError('enum_invalid', `面试方式「${type}」不在枚举中(${Object.keys(typeFull.map).join(' / ')})`);
|
|
834
850
|
}
|
|
835
851
|
const sessionMap = await getDsOptions(host, objId, fieldIdOf('interview_session'), cache.appId);
|
|
836
852
|
const sessionOptionId = sessionMap[session];
|
|
@@ -985,6 +1001,7 @@ const interviewArrangePrepare = {
|
|
|
985
1001
|
: {}),
|
|
986
1002
|
notify: notify ? '将触发「新建日程」面试通知动作流(外部通知)' : '面试通知默认不触发',
|
|
987
1003
|
},
|
|
1004
|
+
deprecated: '本入口副作用不含页面按钮动作流(无新建EB日程/创建视频会议/AI面试提醒)且不并入页面默认值,建议改用 recruit-stage.interview.arrange.*(能力相同、副作用完整)',
|
|
988
1005
|
willSubmit: { formId: plan.formId, objId: plan.objId, dataDetails: plan.dataDetails },
|
|
989
1006
|
continuation: token,
|
|
990
1007
|
expiresInSeconds: CONTINUATION_TTL_SECONDS,
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
import { randomUUID } from 'node:crypto';
|
|
23
23
|
import { rsSuccess, schemaOf } from './types.js';
|
|
24
24
|
import { rsFail, rsValidationError, rsConfirmationError } from '../errors.js';
|
|
25
|
-
import { objIdOf, formIdOf, getFormLayout, getFormLayoutMeta, saveFormData, runEsb, getFormButtons, resolvePersonId, getDsOptions, findMenuNode, resolveCurrentUser, buildCardUrl, buildListUrl, talentLinkExtra, pickSaveButtonActions, computeRequiredHint, randHex32, dsOptionsSnapshot, restoreDsOptions, invalidateEnvCache, verifySubmitted, expectedFields, probeCreatePermission, } from '../shared.js';
|
|
25
|
+
import { objIdOf, formIdOf, getFormLayout, getFormLayoutMeta, saveFormData, runEsb, getFormButtons, resolvePersonId, getDsOptions, getDsOptionsFull, findMenuNode, resolveCurrentUser, buildCardUrl, buildListUrl, talentLinkExtra, pickSaveButtonActions, computeRequiredHint, randHex32, dsOptionsSnapshot, restoreDsOptions, invalidateEnvCache, verifySubmitted, expectedFields, probeCreatePermission, } from '../shared.js';
|
|
26
26
|
// 面试计划表单字段 dataKey(缓存 fields 里取)。
|
|
27
27
|
// 注意:digital_id 不放入此列表——它只在「面试方式含 AI」时才是必填,
|
|
28
28
|
// 放进来会让未部署数字人的环境连非 AI 面试都建不了(单独按需校验)。
|
|
@@ -266,9 +266,14 @@ async function buildPlan(opts) {
|
|
|
266
266
|
getDsOptions(host, objId, fid('interview_type')),
|
|
267
267
|
getDsOptions(host, objId, fid('interview_session')),
|
|
268
268
|
]);
|
|
269
|
-
const
|
|
270
|
-
|
|
271
|
-
|
|
269
|
+
const typeFull = await getDsOptionsFull(host, objId, fid('interview_type'));
|
|
270
|
+
const typeId = typeFull.map[type];
|
|
271
|
+
if (!typeId) {
|
|
272
|
+
if (typeFull.disabled.some(function (d) { return d.name === type; })) {
|
|
273
|
+
throw rsFail('面试方式「' + type + '」已禁用(该枚举项 archive=1),请改用其它面试方式');
|
|
274
|
+
}
|
|
275
|
+
throw rsFail('面试方式「' + type + '」不在枚举中(' + Object.keys(typeFull.map).join('/') + ')');
|
|
276
|
+
}
|
|
272
277
|
const sessionId = sessionMap[session];
|
|
273
278
|
if (!sessionId)
|
|
274
279
|
throw rsFail('面试轮次「' + session + '」不在枚举中(' + Object.keys(sessionMap).join('/') + ')');
|
|
@@ -786,10 +791,14 @@ async function prefill(args, env) {
|
|
|
786
791
|
const typeFid = fields.interview_type;
|
|
787
792
|
if (!typeFid)
|
|
788
793
|
throw rsFail('面试计划缺少字段 interview_type(ds/fields 解析不到)');
|
|
789
|
-
const
|
|
790
|
-
const typeId =
|
|
791
|
-
if (!typeId)
|
|
792
|
-
|
|
794
|
+
const typeFull = await getDsOptionsFull(ctx.host, objId, typeFid);
|
|
795
|
+
const typeId = typeFull.map[typeKey];
|
|
796
|
+
if (!typeId) {
|
|
797
|
+
if (typeFull.disabled.some(function (d) { return d.name === typeKey; })) {
|
|
798
|
+
throw rsFail('面试方式「' + typeKey + '」已禁用(该枚举项 archive=1),请改用其它面试方式');
|
|
799
|
+
}
|
|
800
|
+
throw rsFail('面试方式「' + typeKey + '」不在枚举中(' + Object.keys(typeFull.map).join('/') + ')');
|
|
801
|
+
}
|
|
793
802
|
const cardUrl = resolveTalentCardUrl(ctx, talentId);
|
|
794
803
|
const listUrl = await resolveInterviewListUrl(ctx).catch(() => null);
|
|
795
804
|
const jsExpr = `(() => { const W = window.WeFormSDK; const i = W && W.getWeFormInstance('ebuilderform', '${formId}');`
|
|
@@ -421,6 +421,12 @@ function ambiguousPerson(keyword, rows) {
|
|
|
421
421
|
* prepare 可通过 dsOptionsSnapshot() 把结果放进 continuation,apply 用 restoreDsOptions() 复用,避免重复请求。
|
|
422
422
|
*/
|
|
423
423
|
const dsOptionsMemo = new Map();
|
|
424
|
+
/**
|
|
425
|
+
* getDsOptionsFull 独立 memo:它返回 {map, disabled},结构与 dsOptionsMemo 的 Record 不同。
|
|
426
|
+
* 混用会让 dsOptionsSnapshot() 把 full 结构写进 continuation,apply 复用时报类型错误,
|
|
427
|
+
* 所以两者分开缓存;full 的结果不进快照,apply 时按需回源。
|
|
428
|
+
*/
|
|
429
|
+
const dsOptionsFullMemo = new Map();
|
|
424
430
|
export function restoreDsOptions(snapshot) {
|
|
425
431
|
for (const [key, value] of Object.entries(snapshot || {})) {
|
|
426
432
|
if (value && typeof value === 'object' && Object.keys(value).length) {
|
|
@@ -508,6 +514,7 @@ export async function verifySubmitted(opts) {
|
|
|
508
514
|
/** 回查/校验失败时清空进程内枚举 memo,并标记磁盘环境缓存失效(下次自动重建)。 */
|
|
509
515
|
export function invalidateEnvCache(baseUrl, appId) {
|
|
510
516
|
dsOptionsMemo.clear();
|
|
517
|
+
dsOptionsFullMemo.clear();
|
|
511
518
|
if (!baseUrl || !appId)
|
|
512
519
|
return;
|
|
513
520
|
try {
|
|
@@ -518,9 +525,10 @@ export function invalidateEnvCache(baseUrl, appId) {
|
|
|
518
525
|
}
|
|
519
526
|
catch { /* 缓存文件不存在/只读盘:不影响主流程 */ }
|
|
520
527
|
}
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
const
|
|
528
|
+
/** 全量版:map 排除 archive=1 的禁用项,disabled 单独列出供「已禁用」精确报错。 */
|
|
529
|
+
export async function getDsOptionsFull(host, objId, fieldId, groupId = '') {
|
|
530
|
+
const key = objId + ':' + fieldId + (groupId ? ':' + groupId : '') + ':full';
|
|
531
|
+
const hit = dsOptionsFullMemo.get(key);
|
|
524
532
|
if (hit)
|
|
525
533
|
return hit;
|
|
526
534
|
const task = (async () => {
|
|
@@ -531,14 +539,31 @@ export async function getDsOptions(host, objId, fieldId, groupId = '') {
|
|
|
531
539
|
});
|
|
532
540
|
const list = r?.data || [];
|
|
533
541
|
const map = {};
|
|
534
|
-
|
|
535
|
-
|
|
542
|
+
const disabled = [];
|
|
543
|
+
for (const x of list) {
|
|
544
|
+
if (!x?.name || !x?.id)
|
|
545
|
+
continue;
|
|
546
|
+
if (String(x.archive) === '1')
|
|
547
|
+
disabled.push({ name: String(x.name), id: String(x.id) });
|
|
548
|
+
else
|
|
536
549
|
map[String(x.name)] = String(x.id);
|
|
550
|
+
}
|
|
537
551
|
// 空结果不缓存:字典引用类字段可能临时返回空,下次应能重新回源
|
|
538
|
-
if (!Object.keys(map).length)
|
|
539
|
-
|
|
540
|
-
return map;
|
|
552
|
+
if (!Object.keys(map).length && !disabled.length)
|
|
553
|
+
dsOptionsFullMemo.delete(key);
|
|
554
|
+
return { map, disabled };
|
|
541
555
|
})();
|
|
556
|
+
dsOptionsFullMemo.set(key, task);
|
|
557
|
+
task.catch(() => { dsOptionsFullMemo.delete(key); });
|
|
558
|
+
return task;
|
|
559
|
+
}
|
|
560
|
+
export async function getDsOptions(host, objId, fieldId, groupId = '') {
|
|
561
|
+
// key 沿用旧口径(不含 groupId),保证 dsOptionsSnapshot() 的键与 apply 复用一致
|
|
562
|
+
const key = objId + ':' + fieldId;
|
|
563
|
+
const hit = dsOptionsMemo.get(key);
|
|
564
|
+
if (hit)
|
|
565
|
+
return hit;
|
|
566
|
+
const task = getDsOptionsFull(host, objId, fieldId, groupId).then((r) => r.map);
|
|
542
567
|
dsOptionsMemo.set(key, task);
|
|
543
568
|
task.catch(() => { dsOptionsMemo.delete(key); });
|
|
544
569
|
return task;
|
|
@@ -102,6 +102,126 @@ function boolOption(value) {
|
|
|
102
102
|
return undefined;
|
|
103
103
|
return value === true || value === 'true' || value === '1';
|
|
104
104
|
}
|
|
105
|
+
const BATCH_MAX_ITEMS = 1000;
|
|
106
|
+
/**
|
|
107
|
+
* 在 item.input 里解析 `$prev.<path>` 引用:字符串值整体形如 "$prev.a.b" 时,
|
|
108
|
+
* 从上一个成功 item 的结果 data 里按点路径取值(典型用法:prepare 的 continuation
|
|
109
|
+
* 传给下一步 apply,同一进程内串行链式执行)。上一个 item 失败或路径取不到值则报错。
|
|
110
|
+
*/
|
|
111
|
+
function resolvePrevRefs(input, prevData) {
|
|
112
|
+
const resolved = {};
|
|
113
|
+
for (const [key, value] of Object.entries(input)) {
|
|
114
|
+
if (typeof value === 'string' && value.startsWith('$prev.')) {
|
|
115
|
+
if (!prevData) {
|
|
116
|
+
throw imValidationError('prev_unavailable', `${key}:$prev 引用不可用(上一项失败或不存在)`);
|
|
117
|
+
}
|
|
118
|
+
let cursor = prevData;
|
|
119
|
+
for (const seg of value.slice(6).split('.')) {
|
|
120
|
+
if (cursor && typeof cursor === 'object' && seg in cursor) {
|
|
121
|
+
cursor = cursor[seg];
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
throw imValidationError('prev_ref_missing', `${key}:$prev 路径 "${value.slice(6)}" 在上一项结果中不存在`);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
resolved[key] = cursor;
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
resolved[key] = value;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return resolved;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* `im run-batch`:单进程内**严格串行**执行多个 operation(禁止并发),
|
|
137
|
+
* 等当前项出结果(成功/失败)才执行下一项;每项独立 envelope,最后输出一个聚合 envelope。
|
|
138
|
+
* 目的:把「N 个 operation = N 次 CLI 冷启动」压成 1 次进程启动,批量场景耗时大幅下降。
|
|
139
|
+
* item.input 字符串值支持 "$prev.xxx" 引用上一项结果(prepare→apply 链式场景)。
|
|
140
|
+
*/
|
|
141
|
+
async function executeBatchAndPrint(ctx, input, stopOnFailure) {
|
|
142
|
+
const rawItems = input.items;
|
|
143
|
+
if (!Array.isArray(rawItems) || rawItems.length === 0) {
|
|
144
|
+
throw imValidationError('batch_items_required', 'batch 输入必须包含非空 items 数组');
|
|
145
|
+
}
|
|
146
|
+
if (rawItems.length > BATCH_MAX_ITEMS) {
|
|
147
|
+
throw imValidationError('batch_items_too_many', `items 超过上限 ${BATCH_MAX_ITEMS}`);
|
|
148
|
+
}
|
|
149
|
+
const items = [];
|
|
150
|
+
rawItems.forEach((raw, i) => {
|
|
151
|
+
if (!raw || typeof raw !== 'object' || Array.isArray(raw) || typeof raw.operation !== 'string') {
|
|
152
|
+
throw imValidationError('batch_item_invalid', `items[${i}] 必须是含 operation 字符串字段的对象`);
|
|
153
|
+
}
|
|
154
|
+
const item = raw;
|
|
155
|
+
items.push({
|
|
156
|
+
operation: String(item.operation),
|
|
157
|
+
input: (item.input && typeof item.input === 'object' && !Array.isArray(item.input))
|
|
158
|
+
? { ...item.input }
|
|
159
|
+
: {},
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
const results = [];
|
|
163
|
+
let prevData = null;
|
|
164
|
+
let prevFailed = false;
|
|
165
|
+
let okCount = 0;
|
|
166
|
+
let failCount = 0;
|
|
167
|
+
const started = Date.now();
|
|
168
|
+
for (let i = 0; i < items.length; i++) {
|
|
169
|
+
const { operation, input: rawInput } = items[i];
|
|
170
|
+
// 严格串行:上一项未落地(成功/失败)绝不开始下一项;$prev 引用且上一项失败则跳过本项
|
|
171
|
+
let itemError = prevFailed && Object.values(rawInput ?? {}).some((v) => typeof v === 'string' && v.startsWith('$prev.')) ? imValidationError('prev_failed_skipped', '上一项失败,本项依赖 $prev 引用被跳过') : null;
|
|
172
|
+
let envelope;
|
|
173
|
+
if (!itemError) {
|
|
174
|
+
try {
|
|
175
|
+
const merged = resolvePrevRefs(rawInput ?? {}, prevData);
|
|
176
|
+
const result = await executeImOperation(operation, merged, {
|
|
177
|
+
ctx,
|
|
178
|
+
host: createImHost(ctx),
|
|
179
|
+
continuation: createImContinuationSigner(ctx),
|
|
180
|
+
});
|
|
181
|
+
envelope = successEnvelope(operation, result);
|
|
182
|
+
prevData = result.data === undefined ? null : result.data;
|
|
183
|
+
prevFailed = false;
|
|
184
|
+
okCount++;
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
envelope = failureEnvelope(error);
|
|
188
|
+
prevData = null;
|
|
189
|
+
prevFailed = true;
|
|
190
|
+
failCount++;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
envelope = failureEnvelope(itemError);
|
|
195
|
+
prevData = null;
|
|
196
|
+
prevFailed = true;
|
|
197
|
+
failCount++;
|
|
198
|
+
}
|
|
199
|
+
results.push({ index: i, operation, ...envelope });
|
|
200
|
+
// 进度走 stderr(不影响 stdout 的单个聚合 JSON)
|
|
201
|
+
process.stderr.write(`[batch ${i + 1}/${items.length}] ${operation} ${envelope.ok ? 'ok' : 'failed'}\n`);
|
|
202
|
+
if (stopOnFailure && !envelope.ok) {
|
|
203
|
+
// 剩余项不再执行,逐项记为 skipped
|
|
204
|
+
for (let j = i + 1; j < items.length; j++) {
|
|
205
|
+
results.push({ index: j, operation: items[j].operation, ok: false, error: { type: 'batch', subtype: 'skipped_stop_on_failure' } });
|
|
206
|
+
}
|
|
207
|
+
failCount += items.length - 1 - i;
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
const ok = failCount === 0;
|
|
212
|
+
ctx.output.write({
|
|
213
|
+
schemaVersion: 1,
|
|
214
|
+
ok,
|
|
215
|
+
operation: 'im.run-batch',
|
|
216
|
+
data: {
|
|
217
|
+
results,
|
|
218
|
+
summary: { total: items.length, ok: okCount, failed: failCount, elapsedMs: Date.now() - started },
|
|
219
|
+
},
|
|
220
|
+
warnings: [],
|
|
221
|
+
}, { json: true });
|
|
222
|
+
if (!ok)
|
|
223
|
+
process.exitCode = ExitCode.GeneralError;
|
|
224
|
+
}
|
|
105
225
|
/**
|
|
106
226
|
* 易秒办(即时通讯)CLI 命令注册。
|
|
107
227
|
* 所有操作统一走 `run <operation> --input-json '{}'`;便捷命令只覆盖高频只读场景,
|
|
@@ -127,6 +247,14 @@ export const imShortcut = {
|
|
|
127
247
|
.action(action(async (ctx, operation, options) => {
|
|
128
248
|
await executeAndPrint(ctx, String(operation), await inputFrom(options));
|
|
129
249
|
}));
|
|
250
|
+
// ---- 单进程批量执行:一次 CLI 冷启动串行跑完 N 个 operation(严格串行,禁止并发) ----
|
|
251
|
+
withJsonInputOptions(im.command('run-batch')
|
|
252
|
+
.description('Run multiple im operations sequentially in one process (strictly serial, no concurrency)')
|
|
253
|
+
.option('--stop-on-failure', 'skip all remaining items after the first failure'))
|
|
254
|
+
.action(action(async (ctx, options) => {
|
|
255
|
+
const opts = asOptions(options);
|
|
256
|
+
await executeBatchAndPrint(ctx, await inputFrom(opts), boolOption(opts.stopOnFailure) === true);
|
|
257
|
+
}));
|
|
130
258
|
// ---- 高频便捷命令:会话 ----
|
|
131
259
|
const session = im.command('session').description('Session commands');
|
|
132
260
|
withJsonInputOptions(session.command('list')
|
|
@@ -160,6 +160,12 @@ const sessionList = {
|
|
|
160
160
|
sessionType: type,
|
|
161
161
|
sessionTypeName: typeName,
|
|
162
162
|
name,
|
|
163
|
+
// 目标 id:单聊对方 uid/cid、群聊 group_id、系统消息分组 group(直接可用于发消息/查消息,不用再按名字反查)
|
|
164
|
+
...([1, 6, 9].includes(type) && s?.fuser
|
|
165
|
+
? { toUid: str(s.fuser.uid), toCid: str(s.fuser.cid) }
|
|
166
|
+
: {}),
|
|
167
|
+
...([2, 3, 7, 11].includes(type) && s?.group_id ? { groupId: str(s.group_id) } : {}),
|
|
168
|
+
...([4, 10].includes(type) && s?.group ? { group: str(s.group) } : {}),
|
|
163
169
|
unread: Number(unread),
|
|
164
170
|
dontDisturb,
|
|
165
171
|
unreadLabel: Number(unread) > 0 ? (dontDisturb ? `${unread}(免打扰)` : String(unread)) : '',
|
|
@@ -986,7 +986,6 @@ export const invoiceOperations = [
|
|
|
986
986
|
relatedInvoiceId: { type: 'string' },
|
|
987
987
|
invoiceTotal: { type: 'string' },
|
|
988
988
|
}, ['relatedInvoiceId', 'invoiceTotal']), { description: '额度用完后没进明细、留在票夹的发票' }),
|
|
989
|
-
debugTrace: { type: 'array', description: '排查用:入参、每行金额分摊、请求体、接口返回' },
|
|
990
989
|
finalMarkdown: { type: 'string', description: '[processTitle](url),直接展示给用户' },
|
|
991
990
|
result: rawObject,
|
|
992
991
|
workflow: workflowSchema,
|
|
@@ -45,9 +45,6 @@ function normalizeInvoices(value) {
|
|
|
45
45
|
}
|
|
46
46
|
return invoices;
|
|
47
47
|
}
|
|
48
|
-
function formatRemaining(cents) {
|
|
49
|
-
return Number.isFinite(cents) ? formatCents(cents) : '不封顶';
|
|
50
|
-
}
|
|
51
48
|
function workflowViewUrl(baseUrl, requestId) {
|
|
52
49
|
return `${baseUrl.replace(/\/+$/, '')}/sp/workflow/flowpage/view/${requestId}`;
|
|
53
50
|
}
|
|
@@ -60,16 +57,6 @@ function workflowViewUrl(baseUrl, requestId) {
|
|
|
60
57
|
export class InvoiceReimSubsidySubmitOperation {
|
|
61
58
|
name = 'invoice.reim.subsidy.submit';
|
|
62
59
|
async execute(input, { host }) {
|
|
63
|
-
const debugTrace = [];
|
|
64
|
-
const debug = (step, detail) => {
|
|
65
|
-
debugTrace.push({ step, detail });
|
|
66
|
-
const message = `[${this.name}] ${step} ${typeof detail === 'string' ? detail : JSON.stringify(detail)}`;
|
|
67
|
-
host.debug?.(message);
|
|
68
|
-
// `--json` 时 logger.debug 会被关掉;单测环境不打 stderr,避免刷屏。
|
|
69
|
-
if (!process.env.NODE_TEST_CONTEXT)
|
|
70
|
-
console.error(message);
|
|
71
|
-
};
|
|
72
|
-
debugger; // 入口:核对入参
|
|
73
60
|
const processTitle = asNonEmptyString(input.processTitle, 'processTitle');
|
|
74
61
|
const reason = asNonEmptyString(input.reason, 'reason');
|
|
75
62
|
const relatedProcessId = asPositiveString(input.relatedProcessId, 'relatedProcessId');
|
|
@@ -77,54 +64,22 @@ export class InvoiceReimSubsidySubmitOperation {
|
|
|
77
64
|
const customerId = optionalId(input.customerId, 'customerId') || DEFAULT_CUSTOMER_ID;
|
|
78
65
|
const projectId = optionalId(input.projectId, 'projectId');
|
|
79
66
|
const allowanceCents = amountCents(input.monthlyAllowance, 'monthlyAllowance');
|
|
80
|
-
debug('1/5 入参', {
|
|
81
|
-
processTitle,
|
|
82
|
-
reason,
|
|
83
|
-
relatedProcessId,
|
|
84
|
-
invoices: invoices.map((item) => ({ fid: item.fid, total: formatCents(item.cents) })),
|
|
85
|
-
monthlyAllowance: allowanceCents === null ? null : formatCents(allowanceCents),
|
|
86
|
-
customerId,
|
|
87
|
-
projectId,
|
|
88
|
-
});
|
|
89
67
|
let remainingCents = allowanceCents ?? Number.POSITIVE_INFINITY;
|
|
90
68
|
const details = [];
|
|
91
69
|
const skipped = [];
|
|
92
70
|
for (const item of invoices) {
|
|
93
71
|
if (remainingCents <= 0) {
|
|
94
72
|
skipped.push(item);
|
|
95
|
-
debug('2/5 额度已用完,不进明细', { fid: item.fid, total: formatCents(item.cents) });
|
|
96
73
|
continue;
|
|
97
74
|
}
|
|
98
|
-
const remainingBefore = remainingCents;
|
|
99
75
|
const reimbursedCents = Math.min(item.cents, remainingCents);
|
|
100
76
|
remainingCents -= reimbursedCents;
|
|
101
77
|
details.push({ ...item, reimbursedCents });
|
|
102
|
-
debug('2/5 明细行', {
|
|
103
|
-
fid: item.fid,
|
|
104
|
-
total: formatCents(item.cents),
|
|
105
|
-
remainingBefore: formatRemaining(remainingBefore),
|
|
106
|
-
reimbursedAmount: formatCents(reimbursedCents),
|
|
107
|
-
remainingAfter: formatRemaining(remainingCents),
|
|
108
|
-
});
|
|
109
78
|
}
|
|
110
79
|
const relatedInvoiceIds = details.map((item) => item.fid);
|
|
111
80
|
const invoiceTotalCents = invoices.reduce((sum, item) => sum + item.cents, 0);
|
|
112
81
|
const reimbursedTotalCents = details.reduce((sum, item) => sum + item.reimbursedCents, 0);
|
|
113
82
|
const capped = reimbursedTotalCents < invoiceTotalCents;
|
|
114
|
-
debug('2/5 金额汇总', {
|
|
115
|
-
invoiceTotal: formatCents(invoiceTotalCents),
|
|
116
|
-
reimbursedAmount: formatCents(reimbursedTotalCents),
|
|
117
|
-
capped,
|
|
118
|
-
detailCount: details.length,
|
|
119
|
-
skippedCount: skipped.length,
|
|
120
|
-
details: details.map((item) => ({
|
|
121
|
-
fid: item.fid,
|
|
122
|
-
total: formatCents(item.cents),
|
|
123
|
-
reimbursedAmount: formatCents(item.reimbursedCents),
|
|
124
|
-
})),
|
|
125
|
-
skipped: skipped.map((item) => ({ fid: item.fid, total: formatCents(item.cents) })),
|
|
126
|
-
});
|
|
127
|
-
debugger; // 金额分摊完成:看 details / skipped / remainingCents
|
|
128
83
|
const session = await host.getSession();
|
|
129
84
|
const currentEmpId = asPositiveString(session.userId, '当前人员 ID');
|
|
130
85
|
const body = {
|
|
@@ -140,21 +95,6 @@ export class InvoiceReimSubsidySubmitOperation {
|
|
|
140
95
|
reimbursedAmount: formatCents(item.reimbursedCents),
|
|
141
96
|
})),
|
|
142
97
|
};
|
|
143
|
-
debug('3/5 请求体', {
|
|
144
|
-
path: SUBSIDY_SUBMIT_PATH,
|
|
145
|
-
autoCommit: body.autoCommit,
|
|
146
|
-
processTitle: body.processTitle,
|
|
147
|
-
reason: body.reason,
|
|
148
|
-
currentEmpId,
|
|
149
|
-
customerId,
|
|
150
|
-
projectId,
|
|
151
|
-
detailList: details.map((item) => ({
|
|
152
|
-
relatedProcessId,
|
|
153
|
-
relatedInvoiceId: item.fid,
|
|
154
|
-
reimbursedAmount: formatCents(item.reimbursedCents),
|
|
155
|
-
})),
|
|
156
|
-
});
|
|
157
|
-
debugger; // 即将发请求:看 body.detailList[].reimbursedAmount
|
|
158
98
|
let result;
|
|
159
99
|
try {
|
|
160
100
|
result = await host.invoiceRequest({
|
|
@@ -164,19 +104,13 @@ export class InvoiceReimSubsidySubmitOperation {
|
|
|
164
104
|
operation: this.name,
|
|
165
105
|
timeoutMs: 90_000,
|
|
166
106
|
});
|
|
167
|
-
debug('4/5 接口返回', result);
|
|
168
|
-
debugger; // 接口已返回:看 result.data.requestId / data.code
|
|
169
107
|
}
|
|
170
108
|
catch (error) {
|
|
171
|
-
const failure = error;
|
|
172
|
-
debug('4/5 请求异常', { type: failure?.type, subtype: failure?.subtype, code: failure?.code, message: failure?.message });
|
|
173
|
-
debugger; // 请求异常:看 failure / debugTrace
|
|
174
109
|
if (isInvoiceNetworkError(error)) {
|
|
175
110
|
throw invoicePartialError('报销提交请求发出后连接中断,结果不确定,禁止自动重试', {
|
|
176
111
|
processTitle,
|
|
177
112
|
relatedProcessId,
|
|
178
113
|
relatedInvoiceIds,
|
|
179
|
-
debugTrace,
|
|
180
114
|
workflow: workflow(this.name, 'EXECUTING'),
|
|
181
115
|
}, { stage: 'submit' });
|
|
182
116
|
}
|
|
@@ -185,10 +119,9 @@ export class InvoiceReimSubsidySubmitOperation {
|
|
|
185
119
|
const data = result?.data && typeof result.data === 'object' ? result.data : {};
|
|
186
120
|
const dataCode = data.code;
|
|
187
121
|
if (result?.status === false || result?.fail === true || (dataCode !== undefined && Number(dataCode) !== 0)) {
|
|
188
|
-
debug('4/5 业务失败', { dataCode, msg: data.msg || result?.msg });
|
|
189
122
|
throw new InvoiceCliError('api', 'reim_subsidy_submit_failed', data.msg || result?.msg || '话费 / 油费报销提交失败', {
|
|
190
123
|
code: dataCode ?? result?.code,
|
|
191
|
-
details: { result
|
|
124
|
+
details: { result },
|
|
192
125
|
exitCode: 1,
|
|
193
126
|
});
|
|
194
127
|
}
|
|
@@ -197,12 +130,10 @@ export class InvoiceReimSubsidySubmitOperation {
|
|
|
197
130
|
throw invoicePartialError('报销提交接口返回成功但没有流程 ID,结果不确定,禁止自动重试', {
|
|
198
131
|
processTitle,
|
|
199
132
|
result,
|
|
200
|
-
debugTrace,
|
|
201
133
|
workflow: workflow(this.name, 'VERIFYING'),
|
|
202
134
|
}, { stage: 'submit-response' });
|
|
203
135
|
}
|
|
204
136
|
const url = workflowViewUrl(session.baseUrl, requestId);
|
|
205
|
-
debug('5/5 完成', { requestId, url });
|
|
206
137
|
return {
|
|
207
138
|
status: 'COMPLETE',
|
|
208
139
|
data: {
|
|
@@ -223,7 +154,6 @@ export class InvoiceReimSubsidySubmitOperation {
|
|
|
223
154
|
relatedInvoiceId: item.fid,
|
|
224
155
|
invoiceTotal: formatCents(item.cents),
|
|
225
156
|
})),
|
|
226
|
-
debugTrace,
|
|
227
157
|
finalMarkdown: `[${processTitle}](${url})`,
|
|
228
158
|
result,
|
|
229
159
|
workflow: workflow(this.name, 'COMPLETE'),
|
|
@@ -518,16 +518,37 @@ const ebConflictRoom = {
|
|
|
518
518
|
properties: {
|
|
519
519
|
beginDatetime: { ...SCHEMA_DATETIME_MINUTE, description: '开始时间(必填,yyyy-MM-dd HH:mm)' },
|
|
520
520
|
endDatetime: { ...SCHEMA_DATETIME_MINUTE, description: '结束时间(必填,yyyy-MM-dd HH:mm)' },
|
|
521
|
-
address: { ...SCHEMA_ID, description: '会议室 id
|
|
521
|
+
address: { ...SCHEMA_ID, description: '会议室 id;与 room_name 二选一(推荐直接传 room_name)' },
|
|
522
|
+
room_name: { type: 'string', description: '会议室名称(如「317」「317会议室」):内部解析成 id,省掉先查列表这一步' },
|
|
522
523
|
mtId: { ...SCHEMA_ID, description: '变更会议时排除自身' },
|
|
523
524
|
},
|
|
524
|
-
required: ['beginDatetime', 'endDatetime'
|
|
525
|
+
required: ['beginDatetime', 'endDatetime'],
|
|
525
526
|
},
|
|
526
527
|
handler: async (args, env) => {
|
|
528
|
+
// ⛔ 2026-11-09:以前只收 id,调用方要先拉全量清单找 id(155 间 × 多页,耗时上百秒)。
|
|
529
|
+
// 现在允许直接传 room_name,内部一次性解析,省掉“查清单 → 找 id → 再查冲突”的绕路。
|
|
530
|
+
let addressId = String(args.address ?? '').trim();
|
|
531
|
+
let resolvedRoom = null;
|
|
532
|
+
if (!addressId && String(args.room_name ?? '').trim()) {
|
|
533
|
+
const { resolveAddressRoom } = await import('./create-flow.js');
|
|
534
|
+
const resolved = await resolveAddressRoom(env, String(args.room_name));
|
|
535
|
+
if (!resolved?.id) {
|
|
536
|
+
throw meetingValidationError('room_not_found', `找不到名为「${String(args.room_name)}」的会议室,请用 meeting.eb.room.list 核对名称`);
|
|
537
|
+
}
|
|
538
|
+
addressId = String(resolved.id);
|
|
539
|
+
resolvedRoom = { id: String(resolved.id), name: String(resolved.name ?? ''), ...(resolved.status ? { status: String(resolved.status) } : {}) };
|
|
540
|
+
}
|
|
541
|
+
if (!addressId) {
|
|
542
|
+
// room_name 命中多间 / 找不到 → 明确报错,别拿一个假 id 去查出一片“空闲”
|
|
543
|
+
throw meetingValidationError('room_ambiguous', `「${String(args.room_name ?? '')}」匹配不到唯一会议室:请用 meeting.eb.room.list 查到准确名称/ID,或改用 address 传 id`);
|
|
544
|
+
}
|
|
545
|
+
if (!String(args.address ?? '').trim() && resolvedRoom?.status === 'unknown') {
|
|
546
|
+
throw meetingValidationError('room_unresolved', `「${String(args.room_name ?? '')}」在台账里找不到对应会议室(解析到 id=${addressId}),不能据此判断空闲`);
|
|
547
|
+
}
|
|
527
548
|
const outcome = await runEbConflictCheck({
|
|
528
549
|
beginDatetime: args.beginDatetime,
|
|
529
550
|
endDatetime: args.endDatetime,
|
|
530
|
-
address:
|
|
551
|
+
address: addressId,
|
|
531
552
|
...(args.mtId !== undefined ? { excludeMtId: String(args.mtId) } : {}),
|
|
532
553
|
}, env, 'meeting.eb.conflict.room', { throwOnReject: false });
|
|
533
554
|
const room = outcome.room ?? { skipped: true, hasConflict: false, conflicts: [], requests: 0 };
|
|
@@ -539,6 +560,8 @@ const ebConflictRoom = {
|
|
|
539
560
|
? 'rejected'
|
|
540
561
|
: 'warn';
|
|
541
562
|
return meetingSuccess('meeting.eb.conflict.room', {
|
|
563
|
+
// 透明化:告诉调用方 room_name 到底解析成了哪一间,避免「查了别间还以为查对了」
|
|
564
|
+
resolvedRoom,
|
|
542
565
|
verdict,
|
|
543
566
|
hasConflict: room.hasConflict,
|
|
544
567
|
skipped: room.skipped,
|