feat: collect BPM field evidence and equip ZCode mapping assistant
This commit is contained in:
1 parent
24dbbb74c3
commit
d4070e08f9
30 files changed
+453
-61
No files matched your search
@@ -43,7 +43,7 @@ function saveMapping(store,input,actor){shape(input,['processName','processVersi
|
||||
function evaluate(store,draft,captured){
|
||||
const related=categories(store,draft.processName),needDate=related.some(r=>r.draft.filenameDate==='appDate'),mapping={id:draft.id,processName:draft.processName,processVersion:draft.processVersion,sources:draft.sources,verified:true};
|
||||
const rule={id:'mapping-check',name:'信息识别检查',categoryId:'mapping-check',version:draft.version,processNames:[draft.processName],nodeNames:[captured.sample.nodeName],adapterIds:[draft.id],filenameDate:needDate?'appDate':'receivedAt'};
|
||||
const result=previewMatch([rule],[mapping],captured.sample);result.affectedCategories=related.map(r=>({id:r.id,name:r.draft.name}));result.filenames=[];
|
||||
const result=previewMatch([rule],[mapping],captured.sample,{mappingEvidence:true});result.configurationOnly=captured.sample.source==='history';result.warnings=result.configurationOnly?['历史样本只核对字段,未核验通知节点;接收时间文件名示例暂用流程发起时间,实际执行须重新读取通知待办。']:[];result.affectedCategories=related.map(r=>({id:r.id,name:r.draft.name}));result.filenames=[];
|
||||
for(const r of related){const item={categoryId:r.id,categoryName:r.draft.name,filename:null,issues:[]};try{const at=r.draft.filenameDate==='appDate'?result.event.appDate:r.draft.filenameDate==='archiveDate'?store.now():result.event.receivedAt;item.filename=archiveFilename(result.event,r.draft.filenameDate,at);}catch(e){item.issues.push(e.message);}result.filenames.push(item);}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ function validAppDate(value){
|
||||
return value.length===10||Number.isFinite(Date.parse(value.replace(' ','T')));
|
||||
}
|
||||
|
||||
function previewMatch(rules, adapters, input) {
|
||||
function previewMatch(rules, adapters, input, {mappingEvidence=false}={}) {
|
||||
const sample = input && typeof input === 'object' ? input : {};
|
||||
const checks = [], issues = [];
|
||||
const check = (label, ok, detail) => {
|
||||
@@ -27,7 +27,7 @@ function previewMatch(rules, adapters, input) {
|
||||
for (const key of ['connectionId', 'instanceId', 'taskId']) {
|
||||
check('事件身份', scalar(sample[key]) && present(sample[key]), `${key}:${present(sample[key]) ? String(sample[key]) : '缺失'}`);
|
||||
}
|
||||
check('事件来源', sample.source === 'todo', 'source 必须为 todo(待办)');
|
||||
check('事件来源', sample.source === 'todo'||mappingEvidence&&sample.source==='history'&&sample.configurationOnly===true, 'source 必须为 todo(待办);历史证据仅限字段配置检查');
|
||||
check('事件修订', scalar(sample.revision) && present(sample.revision), `revision:${present(sample.revision) ? String(sample.revision) : '缺失'}`);
|
||||
check('接收时间', nonblank(sample.receivedAt) && /T.*(?:Z|[+-]\d{2}:\d{2})$/.test(sample.receivedAt) && Number.isFinite(Date.parse(sample.receivedAt)), 'receivedAt 必须是带时区的有效时间');
|
||||
for (const key of ['processName', 'processVersion', 'nodeName']) {
|
||||
|
||||
@@ -10,8 +10,11 @@ function extractTitle(title){
|
||||
for(let i=0;i<matches.length;i++){
|
||||
const match=matches[i],label=match[1],value=text.slice(match.index+match[0].length,matches[i+1]?.index??text.length).trim();
|
||||
if(['业务模式','客户简称'].includes(label)&&value.includes('惠州'))factoryHints.push({source:label,value,status:'待核实额外通知'});
|
||||
if(label==='订单号'){
|
||||
current={orderNo:value,text:''};orders.push(current);
|
||||
if(label==='订单号'&&!/(?:原|参考)$/.test(text.slice(0,match.index))){
|
||||
// Unknown labels and pipe-separated titles still delimit the identifier.
|
||||
// Keep their original content in the notification paragraph below.
|
||||
const identifier=/^([A-Za-z0-9][A-Za-z0-9._/-]*)(?=$|\s|[\p{Script=Han}|,,;;])/u.exec(value)?.[1]||value;
|
||||
current={orderNo:identifier,text:''};orders.push(current);
|
||||
if(!value)issues.push('标题中的订单号为空,不能遗漏该订单段落');
|
||||
}
|
||||
if(current&&retained.has(label))current.text+=`${label}:${value}`;
|
||||
|
||||
Reference in new issue
Block a user