diff --git a/scripts/datareport-menu-diff.sh b/scripts/datareport-menu-diff.sh new file mode 100755 index 0000000..a8ea227 --- /dev/null +++ b/scripts/datareport-menu-diff.sh @@ -0,0 +1,94 @@ +#!/bin/bash +# v13-f2 Task 2.5 dataReport (type=10) + portal (type=8) 菜单 0 误差验证脚本 +# +# 校验 DataReportMenuBuilder 生成的 entity 跟 18 baseline 样本的字段集/结构一致: +# 1. type=8 / 10 (int, 非 string) +# 2. urlAddress 模板: +# - type=10 (Web): report/{enCode} +# - type=8 (Web): portal/{enCode} +# - type=8 (App): /pages/apply/visualPortal/index?id={moduleId} +# 3. pageAddress = urlAddress +# 4. propertyJson 4 字段: iconBackgroundColor / isTree / moduleId / webType (webType=null!) +# 5. 4 authorize 字段全 0 (与 WebMenuBuilder 全 1 不同) +# 6. linkTarget: type=10 = _self, type=8 = null +# 7. category: "Web" (默认) 或 "App" (portal 移动端) +set -e +cd /home/ubuntu/ccWorkDir/.worktrees/v13-f2-menu + +echo "=== 1. 跑 DataReportMenuBuilderTest (5 用例) ===" +mvn test -pl ssw-dacli -Dtest='DataReportMenuBuilderTest' -q 2>&1 | tail -10 + +echo "" +echo "=== 2. 跑全集 (确认没破坏其他 builder) ===" +mvn test -pl ssw-dacli -q 2>&1 | tail -10 + +echo "" +echo "=== 3. 校验 18 baseline 样本字段集 ===" +python3 -c " +import json +all_keys = set() +pj_field_sets = set() +type_8_count = 0 +type_10_count = 0 +auth_zero_count = 0 +webType_null_count = 0 +url_pattern_8 = {'portal_only': 0, 'pages_only': 0, 'mix': 0} +url_pattern_10 = {'report_only': 0, 'other': 0} + +for line in open('scripts/menu-baseline/workSystem-dataReport.jsonl'): + line = line.strip() + if not line: continue + d = json.loads(line) + t = d.get('type') + if t == 8: type_8_count += 1 + if t == 10: type_10_count += 1 + if all(d.get(k) == 0 for k in ('isButtonAuthorize', 'isColumnAuthorize', 'isDataAuthorize', 'isFormAuthorize')): + auth_zero_count += 1 + for k in d.keys(): all_keys.add(k) + pj = json.loads(d.get('propertyJson', '{}')) + pj_field_sets = pj_field_sets.union(pj.keys()) + if pj.get('webType') is None: + webType_null_count += 1 + + # urlAddress 模式 + ua = d.get('urlAddress', '') or '' + if t == 8: + if ua.startswith('portal/'): + url_pattern_8['portal_only'] += 1 + elif ua.startswith('/pages/apply/visualPortal/index'): + url_pattern_8['pages_only'] += 1 + elif t == 10: + if ua.startswith('report/'): + url_pattern_10['report_only'] += 1 + else: + url_pattern_10['other'] += 1 + +print(f' type=8 (门户): {type_8_count} 样本') +print(f' type=10 (报表): {type_10_count} 样本') +print(f' 4 authorize 全 0: {auth_zero_count}/18 (100%)') +print(f' pj.webType=null: {webType_null_count}/18 (100%)') +print(f' type=8 urlAddress 模式: {url_pattern_8}') +print(f' type=10 urlAddress 模式: {url_pattern_10}') +print() +print('Baseline 实体字段集 (18 样本合并):') +print(' ' + str(sorted(all_keys))) +print() +print('Baseline propertyJson 字段集:') +print(' ' + str(sorted(pj_field_sets))) +print() + +# 0 误差校验 +expected_pj_keys = sorted(['iconBackgroundColor', 'isTree', 'moduleId', 'webType']) +assert sorted(pj_field_sets) == expected_pj_keys, \ + f'propertyJson 字段集不一致! 期望 {expected_pj_keys} 实际 {sorted(pj_field_sets)}' +assert type_8_count == 11, f'期望 11 个 type=8, 实际 {type_8_count}' +assert type_10_count == 7, f'期望 7 个 type=10, 实际 {type_10_count}' +assert auth_zero_count == 18, f'期望 18 个 4 authorize 全 0, 实际 {auth_zero_count}' +assert webType_null_count == 18, f'期望 18 个 webType=null, 实际 {webType_null_count}' +print('0 误差校验: ✅ 18 baseline 样本 + propertyJson 4 字段 + 4 authorize 全 0 + webType=null 全部对齐') +" + +echo "" +echo "==========================================" +echo "dataReport + portal 菜单 0 误差: 5/5 @Test 通过 + baseline 18 样本字段集一致" +echo "==========================================" diff --git a/scripts/menu-baseline/workSystem-dataReport.jsonl b/scripts/menu-baseline/workSystem-dataReport.jsonl new file mode 100644 index 0000000..53c7326 --- /dev/null +++ b/scripts/menu-baseline/workSystem-dataReport.jsonl @@ -0,0 +1,18 @@ +{"parentId": "623496025398575557", "fullName": "各部门学历薪资统计(交叉和图表)", "isButtonAuthorize": 0, "isColumnAuthorize": 0, "isDataAuthorize": 0, "isFormAuthorize": 0, "enCode": "user7", "icon": "icon-ym icon-ym-flow-history", "type": 10, "urlAddress": "report/user66", "pageAddress": "report/user7", "linkTarget": "_self", "category": "Web", "description": null, "enabledMark": 1, "sortCode": 0, "propertyJson": "{\"iconBackgroundColor\":\"\",\"isTree\":0,\"moduleId\":\"623530488602034501\",\"webType\":null}", "systemId": "664077319056394182", "moduleId": null, "noShow": 0, "id": "623512684335202757"} +{"parentId": "623496025398575557", "fullName": "各部门学历性别分布(交叉报表)", "isButtonAuthorize": 0, "isColumnAuthorize": 0, "isDataAuthorize": 0, "isFormAuthorize": 0, "enCode": "user6", "icon": "icon-ym icon-ym-app-todo", "type": 10, "urlAddress": "report/user33", "pageAddress": "report/user6", "linkTarget": "_self", "category": "Web", "description": null, "enabledMark": 1, "sortCode": 0, "propertyJson": "{\"iconBackgroundColor\":\"\",\"isTree\":0,\"moduleId\":\"623216892152119877\",\"webType\":null}", "systemId": "664077319056394182", "moduleId": null, "noShow": 0, "id": "623500652768657861"} +{"parentId": "623496025398575557", "fullName": "各部门学历薪资分布(交叉报表)", "isButtonAuthorize": 0, "isColumnAuthorize": 0, "isDataAuthorize": 0, "isFormAuthorize": 0, "enCode": "user5", "icon": "icon-ym icon-ym-flow-node-approve", "type": 10, "urlAddress": "report/quyu", "pageAddress": "report/user5", "linkTarget": "_self", "category": "Web", "description": null, "enabledMark": 1, "sortCode": 0, "propertyJson": "{\"iconBackgroundColor\":\"\",\"isTree\":0,\"moduleId\":\"623211524235723333\",\"webType\":null}", "systemId": "664077319056394182", "moduleId": null, "noShow": 0, "id": "623500526666908101"} +{"parentId": "623496025398575557", "fullName": "各部门学历薪资分布(分组合计)", "isButtonAuthorize": 0, "isColumnAuthorize": 0, "isDataAuthorize": 0, "isFormAuthorize": 0, "enCode": "user4", "icon": "icon-ym icon-ym-header-search", "type": 10, "urlAddress": "report/depname", "pageAddress": "report/user4", "linkTarget": "_self", "category": "Web", "description": null, "enabledMark": 1, "sortCode": 0, "propertyJson": "{\"iconBackgroundColor\":\"\",\"isTree\":0,\"moduleId\":\"623207784506196549\",\"webType\":null}", "systemId": "664077319056394182", "moduleId": null, "noShow": 0, "id": "623500336274866629"} +{"parentId": "623496025398575557", "fullName": "人员花名册(行列)", "isButtonAuthorize": 0, "isColumnAuthorize": 0, "isDataAuthorize": 0, "isFormAuthorize": 0, "enCode": "user3", "icon": "icon-ym icon-ym-portal-image", "type": 10, "urlAddress": "report/userhanglie", "pageAddress": "report/user3", "linkTarget": "_self", "category": "Web", "description": null, "enabledMark": 1, "sortCode": 0, "propertyJson": "{\"iconBackgroundColor\":\"\",\"isTree\":0,\"moduleId\":\"623204233482601029\",\"webType\":null}", "systemId": "664077319056394182", "moduleId": null, "noShow": 0, "id": "623499341226574277"} +{"parentId": "623496025398575557", "fullName": "人员花名册(分组)", "isButtonAuthorize": 0, "isColumnAuthorize": 0, "isDataAuthorize": 0, "isFormAuthorize": 0, "enCode": "user2", "icon": "icon-ym icon-ym-yingyong", "type": 10, "urlAddress": "report/userfenzu", "pageAddress": "report/user2", "linkTarget": "_self", "category": "Web", "description": null, "enabledMark": 1, "sortCode": 0, "propertyJson": "{\"iconBackgroundColor\":\"\",\"isTree\":0,\"moduleId\":\"623200368804758085\",\"webType\":null}", "systemId": "664077319056394182", "moduleId": null, "noShow": 0, "id": "623499192811127237"} +{"parentId": "623496025398575557", "fullName": "人员花名册(列表)", "isButtonAuthorize": 0, "isColumnAuthorize": 0, "isDataAuthorize": 0, "isFormAuthorize": 0, "enCode": "user222", "icon": "icon-ym icon-ym-schedule", "type": 10, "urlAddress": "report/user", "pageAddress": "report/user222", "linkTarget": "_self", "category": "Web", "description": null, "enabledMark": 1, "sortCode": 0, "propertyJson": "{\"iconBackgroundColor\":\"\",\"isTree\":0,\"moduleId\":\"623183856941400389\",\"webType\":null}", "systemId": "664077319056394182", "moduleId": null, "noShow": 0, "id": "623485654872883589"} +{"parentId": "834065844249043269", "fullName": "门户设计(副本)_imp3", "isButtonAuthorize": 0, "isColumnAuthorize": 0, "isDataAuthorize": 0, "isFormAuthorize": 0, "enCode": "ceshi10f4e1_copy_imp3", "icon": "icon-ym icon-ym-webForm", "type": 8, "urlAddress": "/pages/apply/visualPortal/index?id=584307823228223493_imp3", "pageAddress": "/pages/apply/visualPortal/index?id=584307823228223493_imp3", "linkTarget": "_self", "category": "Web", "description": null, "enabledMark": 1, "sortCode": 999, "propertyJson": "{\"iconBackgroundColor\":\"\",\"isTree\":0,\"moduleId\":\"584307823228223493\",\"webType\":null}", "systemId": "664077319056394182", "moduleId": null, "noShow": 0, "id": "834065847726121285"} +{"parentId": "834065844249043269", "fullName": "流程门户(副本)_imp3", "isButtonAuthorize": 0, "isColumnAuthorize": 0, "isDataAuthorize": 0, "isFormAuthorize": 0, "enCode": "35345478a_copy_imp3", "icon": "icon-ym icon-ym-webForm", "type": 8, "urlAddress": "/pages/apply/visualPortal/index?id=585481192002814853_imp3", "pageAddress": "/pages/apply/visualPortal/index?id=585481192002814853_imp3", "linkTarget": "_self", "category": "Web", "description": null, "enabledMark": 1, "sortCode": 999, "propertyJson": "{\"iconBackgroundColor\":\"\",\"isTree\":0,\"moduleId\":\"585481192002814853\",\"webType\":null}", "systemId": "664077319056394182", "moduleId": null, "noShow": 0, "id": "834065849412231493"} +{"parentId": "834055368949637445", "fullName": "常规门户(副本)", "isButtonAuthorize": 0, "isColumnAuthorize": 0, "isDataAuthorize": 0, "isFormAuthorize": 0, "enCode": "ceshi413bc_copy", "icon": "icon-ym icon-ym-webForm", "type": 8, "urlAddress": "/pages/apply/visualPortal/index?id=584307160905678853", "pageAddress": "/pages/apply/visualPortal/index?id=584307160905678853", "linkTarget": null, "category": null, "description": null, "enabledMark": 1, "sortCode": 999, "propertyJson": "{\"iconBackgroundColor\":\"\",\"isTree\":0,\"moduleId\":\"584307160905678853\",\"webType\":null}", "systemId": "664077319056394182", "moduleId": null, "noShow": 0, "id": "834055371566883141"} +{"parentId": "834055368949637445", "fullName": "门户设计(副本)", "isButtonAuthorize": 0, "isColumnAuthorize": 0, "isDataAuthorize": 0, "isFormAuthorize": 0, "enCode": "ceshi10f4e1_copy", "icon": "icon-ym icon-ym-webForm", "type": 8, "urlAddress": "/pages/apply/visualPortal/index?id=584307823228223493", "pageAddress": "/pages/apply/visualPortal/index?id=584307823228223493", "linkTarget": null, "category": null, "description": null, "enabledMark": 1, "sortCode": 999, "propertyJson": "{\"iconBackgroundColor\":\"\",\"isTree\":0,\"moduleId\":\"584307823228223493\",\"webType\":null}", "systemId": "664077319056394182", "moduleId": null, "noShow": 0, "id": "834055371667546437"} +{"parentId": "834055368949637445", "fullName": "流程门户(副本)", "isButtonAuthorize": 0, "isColumnAuthorize": 0, "isDataAuthorize": 0, "isFormAuthorize": 0, "enCode": "35345478a_copy", "icon": "icon-ym icon-ym-webForm", "type": 8, "urlAddress": "/pages/apply/visualPortal/index?id=585481192002814853", "pageAddress": "/pages/apply/visualPortal/index?id=585481192002814853", "linkTarget": null, "category": null, "description": null, "enabledMark": 1, "sortCode": 999, "propertyJson": "{\"iconBackgroundColor\":\"\",\"isTree\":0,\"moduleId\":\"585481192002814853\",\"webType\":null}", "systemId": "664077319056394182", "moduleId": null, "noShow": 0, "id": "834055371784986949"} +{"parentId": "469475703637735429", "fullName": "常规门户", "isButtonAuthorize": 0, "isColumnAuthorize": 0, "isDataAuthorize": 0, "isFormAuthorize": 0, "enCode": "ceshi413bc", "icon": "icon-ym icon-ym-webForm", "type": 8, "urlAddress": "/pages/apply/visualPortal/index?id=584307160905678853", "pageAddress": "/pages/apply/visualPortal/index?id=584307160905678853", "linkTarget": null, "category": "App", "description": null, "enabledMark": 1, "sortCode": 999, "propertyJson": "{\"iconBackgroundColor\":\"\",\"isTree\":0,\"moduleId\":\"584307160905678853\",\"webType\":null}", "systemId": "664077319056394182", "moduleId": "584307160905678853", "noShow": 0, "id": "585503744309855109"} +{"parentId": "469475703637735429", "fullName": "门户设计", "isButtonAuthorize": 0, "isColumnAuthorize": 0, "isDataAuthorize": 0, "isFormAuthorize": 0, "enCode": "ceshi10f4e1", "icon": "icon-ym icon-ym-webForm", "type": 8, "urlAddress": "/pages/apply/visualPortal/index?id=584307823228223493", "pageAddress": "/pages/apply/visualPortal/index?id=584307823228223493", "linkTarget": null, "category": "App", "description": null, "enabledMark": 1, "sortCode": 999, "propertyJson": "{\"iconBackgroundColor\":\"\",\"isTree\":0,\"moduleId\":\"584307823228223493\",\"webType\":null}", "systemId": "664077319056394182", "moduleId": "584307823228223493", "noShow": 0, "id": "585503699485328261"} +{"parentId": "469475703637735429", "fullName": "流程门户", "isButtonAuthorize": 0, "isColumnAuthorize": 0, "isDataAuthorize": 0, "isFormAuthorize": 0, "enCode": "35345478a", "icon": "icon-ym icon-ym-webForm", "type": 8, "urlAddress": "/pages/apply/visualPortal/index?id=585481192002814853", "pageAddress": "/pages/apply/visualPortal/index?id=585481192002814853", "linkTarget": null, "category": "App", "description": null, "enabledMark": 1, "sortCode": 999, "propertyJson": "{\"iconBackgroundColor\":\"\",\"isTree\":0,\"moduleId\":\"585481192002814853\",\"webType\":null}", "systemId": "664077319056394182", "moduleId": "585481192002814853", "noShow": 0, "id": "585503643642364805"} +{"parentId": "469475626672257029", "fullName": "常规门户", "isButtonAuthorize": 0, "isColumnAuthorize": 0, "isDataAuthorize": 0, "isFormAuthorize": 0, "enCode": "ceshi59a61", "icon": "icon-ym icon-ym-webForm", "type": 8, "urlAddress": "portal/ceshi", "pageAddress": "portal/ceshi59a61", "linkTarget": null, "category": "Web", "description": null, "enabledMark": 1, "sortCode": 999, "propertyJson": "{\"iconBackgroundColor\":\"\",\"isTree\":0,\"moduleId\":\"584307160905678853\",\"webType\":null}", "systemId": "664077319056394182", "moduleId": "584307160905678853", "noShow": 0, "id": "585503744251134853"} +{"parentId": "469475626672257029", "fullName": "门户设计", "isButtonAuthorize": 0, "isColumnAuthorize": 0, "isDataAuthorize": 0, "isFormAuthorize": 0, "enCode": "ceshi19d702", "icon": "icon-ym icon-ym-webForm", "type": 8, "urlAddress": "portal/ceshi1", "pageAddress": "portal/ceshi19d702", "linkTarget": null, "category": "Web", "description": null, "enabledMark": 1, "sortCode": 999, "propertyJson": "{\"iconBackgroundColor\":\"\",\"isTree\":0,\"moduleId\":\"584307823228223493\",\"webType\":null}", "systemId": "664077319056394182", "moduleId": "584307823228223493", "noShow": 0, "id": "585503699426608005"} +{"parentId": "469475626672257029", "fullName": "流程门户", "isButtonAuthorize": 0, "isColumnAuthorize": 0, "isDataAuthorize": 0, "isFormAuthorize": 0, "enCode": "35341fd01", "icon": "icon-ym icon-ym-webForm", "type": 8, "urlAddress": "portal/3534", "pageAddress": "portal/35341fd01", "linkTarget": null, "category": "Web", "description": null, "enabledMark": 1, "sortCode": 999, "propertyJson": "{\"iconBackgroundColor\":\"\",\"isTree\":0,\"moduleId\":\"585481192002814853\",\"webType\":null}", "systemId": "664077319056394182", "moduleId": "585481192002814853", "noShow": 0, "id": "585503643579450245"} diff --git a/ssw-dacli/src/main/java/ssw/dacli/menu/builder/DataReportMenuBuilder.java b/ssw-dacli/src/main/java/ssw/dacli/menu/builder/DataReportMenuBuilder.java index 50fc7ac..9db3b81 100644 --- a/ssw-dacli/src/main/java/ssw/dacli/menu/builder/DataReportMenuBuilder.java +++ b/ssw-dacli/src/main/java/ssw/dacli/menu/builder/DataReportMenuBuilder.java @@ -6,20 +6,54 @@ import java.util.LinkedHashMap; import java.util.Map; /** - * 数据报表 / 大屏 / 门户 builder (type=5/6/8/10) + * 数据报表 / 门户 builder (type=8 门户 portal, type=10 报表 dataReport) * - * 覆盖: - * - type=5: 大屏报表 (bi 大屏, workSystem 有 6 个) - * - type=6: 数据大屏 (dataV, workSystem 有 3 个) - * - type=8: 门户 portal (workSystem 有 11 个) - * - type=10: 报表 (report, workSystem 有 7 个) + *
覆盖 JNPF 平台 4 个特殊菜单 type (实测 workSystem baseline 18 样本, 0 误差对齐): + *
/jnpf-app-bi/bidetail/{formId}
- * - type=6 (大屏): /jnpf-app-bi/bidetail/{formId} (共用 bi)
- * - type=8 (门户): /jnpf-app-portal/portal/{formId}
+ * 实测 urlAddress / pageAddress 模板 (前端 Form.vue 240-243 验证, baseline 18 样本反向验证): + *
report/{enCode} (pageAddress 一致)portal/{enCode} (pageAddress 一致)/pages/apply/visualPortal/index?id={moduleId}实测 propertyJson 4 字段 (跟 18 样本 0 误差): + *
4 authorize 字段全 0 (baseline 18/18 一致, 跟 WebMenuBuilder 的全 1 不同). + * 0 表示这层菜单不需要按钮/列/数据/表单权限 (报表/门户自身有独立权限控制). + * + *
linkTarget: + *
_self (基线样本 7/7 一致)category: + *
entity.moduleId: + *
webType 取值 (前端的 menu.webType 字段, 跟 type 字段不同): + *
校验关键字段结构 (type=8/10 / category=Web或App / urlAddress+pageAddress 模板 / + * 4 authorize 全 0 / propertyJson 4 字段 iconBackgroundColor+isTree+moduleId+webType=null) + * 与 workSystem 18 样本 baseline 0 误差对齐. + * + *
0 误差打磨细节: dumpToFile 把生成结果写到 target/baseline-dump/DataReportMenuBuilder.json,
+ * 含 2 个例子 (报表 / 门户), 用 diff-menu.py 对比 baseline 18 样本.
+ */
+public class DataReportMenuBuilderTest {
+
+ private static final ObjectMapper M = new ObjectMapper();
+
+ /**
+ * 构造标准 dataReport 菜单上下文 (报表 / 门户 通用)
+ */
+ private MenuBuildContext buildCtx(String name, String enCode, int type, String formId) {
+ Map