#!/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 "=========================================="