F2-4b: rewrite 规则扩展 + item 改进 + 最终批量结果

- rewrite.py: 新增 _VAADIN_EXTRA_IMPORT_RE / _DSASP_CLIENT_IMPORT_RE /
  _ENVIROMENT_GET_IMPORT_RE 三条 import 剥离规则,统一在 5.9 清理节
  运行;补多余引号修复(源数据 bug "...SQL 100"";")
- run_batch_regression.py: connect_db 优先连本地 eip4dev:5433,
  回退远程 192.168.20.68:5435
- output/rewritten/*.groovy: 规则重跑后的 rewritten 产物更新
- output/manual_workpackage/*.md: 对应工包重生成
- output/batch_regression_20260612_053253.json: 最终批跑结果
  FULL_AUTO 94.1%(476/506);删除 3 个中间产物 JSON
- docs/P1/F2-4批量回归报告.md: 最终通过率写入报告

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-06-12 05:33:41 +08:00
parent 0e3f204ec8
commit aa576ea2c6
48 changed files with 17606 additions and 232 deletions

View File

@@ -1,14 +1,8 @@
# F2-4 批量回归报告
生成时间: 2026-06-12
生成时间: 20260612_053253
测试端点: `POST http://localhost:8093/api/script/execute-template`
并发: 6,范围: FULL_AUTO(507) + NO_S3(815) = 1,322 条
item 策略: 数据库 192.168.20.68:5435 不可达,item={};结果 JSON: `tools/s3_rewriter/output/batch_regression_20260612_024512.json`(0.46 MB,已入库)
本轮含以下修复:
- **磁盘产物 patch**:17 条 FULL_AUTO 脚本的 `import com.vaadin.ui.Notification` 行批量剥离
- **改写器修复(F2-4)**:`rewrite.py` 新增 `_NOTIF_IMPORT_RE`,在 `_apply_dynamic_button` 和 `rewrite_script` 末尾统一剥离 Notification import,下次重跑改写器自动覆盖磁盘产物
- **闭包动词断言修复**:运行时 `addFieldButton` 由 ScriptFacade 捕获为 `actionType=addButton`,已修正专项断言
并发: 6,范围: FULL_AUTO(507) + NO_S3(815) = 1322 条
---
@@ -16,84 +10,73 @@ item 策略: 数据库 192.168.20.68:5435 不可达,item={};结果 JSON: `to
| 范围 | 总数 | 已排除 | 已执行 | 通过 | 失败 | 通过率 |
|------|------|--------|--------|------|------|--------|
| FULL_AUTO | 507 | 1 | 506 | 459 | 47 | **90.7%** |
| NO_S3 | 815 | 2 | 813 | 480 | 333 | **59.0%** |
| **合计** | **1,322** | 3 | **1,319** | **939** | **380** | **71.2%** |
> NO_S3 通过率低(59%)的主因是 293 条 `no_s3_page_call`(原样脚本含 `page.` 调用,预期失败);
> 去除该预期失败后 NO_S3 实际缺口仅 40 条。
| FULL_AUTO | 507 | 1 | 506 | 476 | 30 | 94.1% |
| NO_S3 | 815 | 2 | 813 | 480 | 333 | 59.0% |
| **合计** | **1322** | — | **1319** | **956** | **363** | **72.5%** |
---
## 二、失败归因分桶
| bucket | 数量 | FULL_AUTO | NO_S3 | 性质 |
|--------|------|-----------|-------|------|
| `passed` | 939 | 459 | 480 | 通过 |
| `no_s3_page_call` | 293 | 0 | 293 | **预期**:NO_S3 原样脚本含 page. 调用 |
| `excluded_write_path` | 3 | 1 | 2 | **预期**:写路径安全排除 |
| `engine_exception` | 27 | 4 | 23 | 待定:DB 访问/权限错误(item={} 或基线数据缺失) |
| `compile_error_import` | 25 | 15 | 10 | **真缺口**:legacy/vaadin import 残留 |
| `missing_property` | 10 | 10 | 0 | **部分缺口**:item={} 导致字段为 null |
| `missing_method` | 9 | 5 | 4 | **真缺口**:ScriptFacade 动词表未覆盖 |
| `script_blank_or_missing` | 8 | 2 | 6 | **部分缺口**:全注释空正文(设计内)/ 真缺文件 |
| `http_500` | 8 | 7 | 1 | **真缺口**:脚本执行触发 Spring 未捕获异常 |
**总失败 380 条分解**:
- 预期/已排除: 296 条(`no_s3_page_call` 293 + `excluded_write_path` 3)
- 待确认: 27 条(`engine_exception`,主要是 NO_S3 DB 访问,item 数据后可消除)
- 真缺口: 57 条(`compile_error_import` 25 + `missing_method` 9 + `http_500` 8 + `missing_property` 10 中的非 item 部分 + `script_blank_or_missing` 2 真缺文件)
| bucket | 数量 | 性质 |
|--------|------|------|
| `passed` | 956 | 正常 |
| `no_s3_page_call` | 293 | 预期:原样脚本,非改写产物 |
| `engine_exception` | 27 | 需人工分析 |
| `missing_property` | 13 | 部分因 item={} 导致,部分为真缺口 |
| `compile_error_import` | 12 | 真缺口:vaadin import 未剥离,需重跑改写器 |
| `http_500` | 10 | 真缺口:脚本执行导致未捕获异常 |
| `script_blank_or_missing` | 8 | 文件全注释无正文,或目录缺失 |
| `excluded_write_path` | 3 | 预期跳过,保护 e2e 基线 |
---
## 三、FULL_AUTO top 失败模式样例
### `compile_error_import`(15 条 FULL_AUTO)
- 样例: `3cf83c9f` seq=1 — `unable to resolve class com.vaadin.ui.Notification`
- 样例: `e7670207` seq=7 — `unable to resolve class com.dsasp.server.common.util.HTTPClientUtils`
- 根因:改写器已修 Notification(磁盘 patch + rewrite.py),但 `HTTPClientUtils`/`ValidationException` 等 legacy dsasp 工具类 import 仍残留;需扩展 import 剥离规则白名单
### bucket: `missing_property` (13 条)
- 样例 tid: `2fb53bc0-ec8e-425d-a75e-7369f77200cc`,seq: 2
- 错误摘要: `rw:2fb53bc0-ec8e-425d-a75e-7369f77200cc:2 --- problem evaluating script: singPropertyException: No such property: event for class: Script328`
### `missing_property`(10 条 FULL_AUTO)
- 样例: `2fac21ea` seq=3 — `No such property: map for class: Script`
- 根因:脚本用 `item.map` / `item.xxx` 访问行字段,item={} 时为 null;真实行数据后可消除
### bucket: `http_500` (9 条)
- 样例 tid: `153857ac-5d70-4dc8-882d-1b2b8027be56`,seq: 1
- 错误摘要: `Internal Server Error`
### `missing_method`(5 条 FULL_AUTO)
- 样例: `208996a7` seq=2 — `No signature of method: ScriptFacade$FieldDataSourceHandle.firstItemId()`
- 根因:ScriptFacade FieldDataSourceHandle 未暴露 `firstItemId`/`lastItemId` 等 Vaadin Container 方法
### bucket: `engine_exception` (4 条)
- 样例 tid: `2c672ea6-ee5b-4273-804b-ac0962d1fac7`,seq: 1
- 错误摘要: `未查询到当前用户的个人档案!`
### `http_500`(7 条 FULL_AUTO)
- 样例: `153857ac` seq=1 — `Internal Server Error`(`CustomSearchConditional` 导致)
- 根因:`CustomSearchConditional` 在 ScriptFacade 里被 eval 但调用链触发 DB 查询,item={} 时 NPE/空结果抛出未捕获异常
### bucket: `script_blank_or_missing` (2 条)
- 样例 tid: `1ada38ff-9e1b-4008-925e-cd129a7ed505`,seq: 1
- 错误摘要: `改写后脚本未找到: templateId=1ada38ff-9e1b-4008-925e-cd129a7ed505 seq=1`
### `engine_exception`(4 条 FULL_AUTO)
- 样例: `2c672ea6` seq=1 — `未查询到当前用户的个人档案!`
- 根因:脚本从 DB 查当前用户个人档案,eip4dev 副本无对应数据;属数据环境问题
### bucket: `compile_error_import` (2 条)
- 样例 tid: `81f2610f-5c9b-4249-98de-b07815b0842c`,seq: 2
- 错误摘要: `rw:81f2610f-5c9b-4249-98de-b07815b0842c:2 --- problem evaluating script: oovy.control.MultipleCompilationErrorsException: startup failed:
Script848.groovy: 6: unable to resolve class TableImportExpo`
---
## 四、闭包动词专项(F2-3 dynamic_button / addFieldButton)
> 运行时 `addFieldButton(field, label, closure, index)` 由 ScriptFacade 捕获为
> `actionType="addButton"` + `args.onClick=[子指令数组]` 结构。
| 模板名 | tid | seq | API通过 | closureCmd | verdict |
|--------|-----|-----|---------|------------|---------|
| 培训签到 | `75fb9a46-b87...` | 1 | True | True | **PASS** |
| 进项税发票(批量调整抵扣日期)-五建定制 | `e5a03e54-37b...` | 6 | True | True | **PASS** |
| 付款确认(五建定制) | `e7670207-9cf...` | 7 | False | False | **FAIL** |
| 销项税发票(增加审批通过后)-五建定制 | `f01c2f57-189...` | 5 | True | True | **PASS** |
| 模板名 | tid | seq | API通过 | addButton+onClick | verdict | 备注 |
|--------|-----|-----|---------|-------------------|---------|------|
| 培训签到 | `75fb9a46` | 1 | ✓ | ✓ | **PASS** | 3 commands,含 2 个 addButton+onClick |
| 进项税发票(批量调整抵扣日期)-五建定制 | `e5a03e54` | 6 | ✓ | ✓ | **PASS** | 3 commands,查询按钮 onClick 含子指令 |
| 销项税发票(增加审批通过后)-五建定制 | `f01c2f57` | 5 | ✓ | ✓ | **PASS** | 3 commands,结构同上 |
| 付款确认(五建定制) | `e7670207` | 7 | ✗ | — | **FAIL** | 含 `HTTPClientUtils` import 编译失败,非闭包动词本身问题 |
闭包动词专项通过: 3/4
**闭包动词专项: 3/4 通过**
`e7670207 seq=7` 失败根因:脚本含 `import com.dsasp.server.common.util.HTTPClientUtils`(legacy 工具类,classpath 缺失),编译阶段失败;与 `addFieldButton` 动词本身运行时实装无关。去除该 import 后可通过,属 `compile_error_import` 桶。
### commands 结构样例(培训签到 seq=1)
**培训签到** commands 样例:
```json
[
{
"actionType": "addSubTableButton",
"componentId": "SIGNDETAILS",
"args": {"target": "SELECT", "index": 0}
"args": {
"target": "SELECT",
"index": 0
}
},
{
"actionType": "addButton",
@@ -116,7 +99,7 @@ item 策略: 数据库 192.168.20.68:5435 不可达,item={};结果 JSON: `to
]
```
### commands 结构样例(进项税发票 seq=6,含子指令)
**进项税发票(批量调整抵扣日期)-五建定制** commands 样例:
```json
[
{
@@ -126,71 +109,125 @@ item 策略: 数据库 192.168.20.68:5435 不可达,item={};结果 JSON: `to
"label": "查询",
"index": 0,
"onClick": [
{"actionType": "setValue", "componentId": "TASKS", "args": {"value": null, "bind": true}},
{"actionType": "setValue", "componentId": "TASKS", "args": {"value": [], "bind": true}}
{
"actionType": "setValue",
"componentId": "TASKS",
"args": {
"value": null,
"bind": true
}
},
{
"actionType": "setValue",
"componentId": "TASKS",
"args": {
"value": [],
"bind": true
}
}
]
}
},
{"actionType": "addButton", "componentId": "TASKS", "args": {"label": "全选", "index": 1, "onClick": []}},
{"actionType": "addButton", "componentId": "TASKS", "args": {"label": "取消全选", "index": 2, "onClick": []}}
{
"actionType": "addButton",
"componentId": "TASKS",
"args": {
"label": "全选",
"index": 1,
"onClick": []
}
},
{
"actionType": "addButton",
"componentId": "TASKS",
"args": {
"label": "取消全选",
"index": 2,
"onClick": []
}
}
]
```
**销项税发票(增加审批通过后)-五建定制** commands 样例:
```json
[
{
"actionType": "addButton",
"componentId": "TASKS",
"args": {
"label": "查询",
"index": 0,
"onClick": [
{
"actionType": "setValue",
"componentId": "TASKS",
"args": {
"value": null,
"bind": true
}
},
{
"actionType": "setValue",
"componentId": "TASKS",
"args": {
"value": [],
"bind": true
}
}
]
}
},
{
"actionType": "addButton",
"componentId": "TASKS",
"args": {
"label": "全选",
"index": 1,
"onClick": []
}
},
{
"actionType": "addButton",
"componentId": "TASKS",
"args": {
"label": "取消全选",
"index": 2,
"onClick": []
}
}
]
```
---
## 五、e2e 50 基线复跑
## 五、与「全量可用」差距清单
批量回归前后各跑 1 次基线;另做专项 50 条覆盖全规则族:
| 时间点 | 通过 | 总数 | 通过率 |
|--------|------|------|--------|
| 批量前(1条抽检) | 1 | 1 | 100% |
| 批量后(1条抽检) | 1 | 1 | 100% |
| e2e 专项 50 条 | 46 | 50 | **92%** |
**50 条基线专项结果**:46/50 通过,4 条失败均属已知桶:
- `328b3366 seq=2`:`MissingPropertyException`(item={} 导致,已知 missing_property 桶)
- `2d046844 seq=3`:`MissingMethodException`(ScriptFacade 缺 firstItemId,已知 missing_method 桶)
- `2fb53bc0 seq=2`:`MissingPropertyException`(item={} 导致)
- `153857ac seq=1`:`HTTP 500`(CustomSearchConditional,已知 http_500 桶)
**结论**:e2e 基线 4 条失败全在已知缺口桶内,无新增回归,基线未受批量回归影响。
| bucket | 是否真缺口 | 数量 | 影响 |
|--------|-----------|------|------|
| `no_s3_page_call` | 否 | 293 | NO_S3 原样脚本含 page. 调用,执行失败是预期行为 |
| `engine_exception` | 待定 | 27 | EmptyResultDataAccessException/权限校验等 DB 访问错误;item 为空或基线数据缺失 |
| `missing_property` | 部分 | 13 | item={} 时 getValue 返回 null;真实行数据可消除部分;剩余为真缺口 |
| `compile_error_import` | 是 | 12 | vaadin Notification import 残留(22 条 FULL_AUTO);改写器 import 剥离规则未覆盖 Notification 类;需重跑改写器 |
| `http_500` | 是 | 10 | 脚本执行引发 Spring 未捕获异常(CustomSearchConditional 等);需改写器或 Facade 修复 |
| `script_blank_or_missing` | 部分 | 8 | 全注释空正文(原脚本仅含注释行)属设计内;真文件缺失为真缺口 |
| `excluded_write_path` | 否 | 3 | 安全排除,预期跳过 |
---
## 六、与「全量可用」差距清单
## 六、结论
| bucket | 是否真缺口 | 数量 | 行动项 |
|--------|-----------|------|--------|
| `no_s3_page_call` | **否** | 293 | NO_S3 原样脚本预期失败,不计入缺口 |
| `excluded_write_path` | **否** | 3 | 安全排除预期跳过 |
| `engine_exception` | **待定** | 27 | 主要是 NO_S3 DB 访问/用户数据缺失;提供真实 item 后重测可定量 |
| `compile_error_import` | **是** | 25 | Notification(已 patch 磁盘) + HTTPClientUtils/ValidationException 等 legacy import;改写器需扩展 import 白名单 |
| `missing_property` | **部分** | 10 | item={} 导致;真实行数据后可消除大部分 |
| `missing_method` | **是** | 9 | ScriptFacade 缺 `firstItemId`/`lastItemId`/`getContainerProperty` 等;需扩展动词表 |
| `script_blank_or_missing` | **部分** | 8 | 6 条 NO_S3 全注释属设计内;2 条 FULL_AUTO 空正文为产物缺陷 |
| `http_500` | **是** | 8 | `CustomSearchConditional` 触发 DB 查询抛异常;需 ScriptFacade mock 或改写器替换 |
**真缺口合计(需工程修复)**:42 条(25 import + 9 method + 8 http500)
---
## 七、结论
| 指标 | 数值 |
|------|------|
| FULL_AUTO 执行通过率 | **90.7%**(459/506,排除 1 条写路径) |
| NO_S3 执行通过率 | **59.0%**(480/813,293 条为预期 page. 失败) |
| NO_S3 去预期后通过率 | **92.3%**(480/520) |
| 闭包动词专项 | **3/4 通过**(1 条因 legacy import 编译失败,非闭包动词本身) |
| e2e 50 基线 | **46/50 通过**(4 条均在已知缺口桶) |
| 真缺口条目数 | **42 条**(占已执行 1,319 条的 3.2%) |
- **FULL_AUTO 执行通过率**: 94.1%(476/506 已执行,排除 1 条写路径)
- **NO_S3 执行通过率**: 59.0%(480/813 已执行,大量为预期 page. 调用失败)
- **闭包动词专项**: 3/4 通过
- **结果 JSON**: `/Users/zhengwr/workspace/eip3/eip4-platform/tools/s3_rewriter/output/batch_regression_20260612_053253.json`(若 >1MB 不入库,报告里给统计)
### 真缺口优先级
1. `compile_error_import`(25 条):改写器扩展 import 剥离白名单(HTTPClientUtils/ValidationException 等 legacy dsasp 类),重跑 `run_rewrite.py` 覆盖磁盘产物
2. `http_500`(8 条):ScriptFacade 对 `CustomSearchConditional` 等 DB 调用做 mock 或改写器替换为 `setFieldFilter`
3. `missing_method`(9 条):ScriptFacade `FieldDataSourceHandle` 补充 `firstItemId`/`lastItemId`/`size` 等方法
4. `missing_property`(10 条):提供真实 item 行数据后重测,定量分离 item 因素 vs 真缺口
5. `e7670207 seq=7` 闭包专项 FAIL:移除 HTTPClientUtils import 后重测,届时 4/4 通过
1. `compile_error_import`(32条):改写器需补全 Notification import 剥离规则,重新生成磁盘产物
2. `http_500`(8条):脚本引发 Spring 未捕获异常(CustomSearchConditional 等),需改写器或 Facade 修复
3. `missing_method`(5条):ScriptFacade 函数库覆盖缺口,需扩展动词表
4. `missing_property`(10条):部分因 item={} 导致,真实行数据后重测可定量分离
5. `engine_exception`(27条):NO_S3 DB 访问/权限错误,需分析基线数据完整性
6. `page_binding_missing`:FULL_AUTO 脚本含 page. 调用,分类规则误判,需审查
*本报告由 run_batch_regression.py 自动生成后人工补充 e2e/闭包分析 (F2-4)*
*本报告由 run_batch_regression.py 自动生成 (F2-4)*

File diff suppressed because it is too large Load Diff

View File

@@ -57,8 +57,6 @@ lists.addButton(field, 0);
## 2. 已改写部分(自动产出)
```groovy
import com.dsasp.viewframework.MultiSelectField;
import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.data.Property.ValueChangeEvent;
final def group1 = group;
if (lists == null) {

View File

@@ -78,12 +78,6 @@ professionals?.showDeleteButton(false);
## 2. 已改写部分(自动产出)
```groovy
import com.vaadin.ui.Notification;
import com.vaadin.ui.Notification.Type;
import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.data.Property.ValueChangeEvent;
import com.dsasp.client.viewframework.listener.ConfirmDialogListener;
import com.vaadin.ui.Link;
import com.vaadin.server.ExternalResource;
import com.vaadin.ui.Label;

View File

@@ -57,8 +57,6 @@ lists.addButton(field, 0);
## 2. 已改写部分(自动产出)
```groovy
import com.dsasp.viewframework.MultiSelectField;
import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.data.Property.ValueChangeEvent;
final def group1 = group;
if (lists == null) {

View File

@@ -22,7 +22,6 @@ tie.addExportButton(4);
addSubTableButton("MATERIALDETAILS", "SELECT", 0);
import com.dsasp.client.viewframework.util.TableImportExport;
def tie = new TableImportExport(materiallist,"com.dsasp.pm.materialmanagertj.client.MaterialRequestMasterPlanDetailImportOfTJ");
group.getField("MATERIALDETAILS").setData(tie);
tie.addImportButton(3);

View File

@@ -78,12 +78,6 @@ professionals?.showDeleteButton(false);
## 2. 已改写部分(自动产出)
```groovy
import com.vaadin.ui.Notification;
import com.vaadin.ui.Notification.Type;
import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.data.Property.ValueChangeEvent;
import com.dsasp.client.viewframework.listener.ConfirmDialogListener;
import com.vaadin.ui.Link;
import com.vaadin.server.ExternalResource;
import com.vaadin.ui.Label;

View File

@@ -176,9 +176,6 @@ invoicelist?.addButton(cb, 0);
```groovy
import com.dsasp.server.common.exception.ValidationException;
import com.dsasp.server.common.util.HTTPClientUtils;
import com.vaadin.ui.Notification;
import com.vaadin.ui.Notification.Type;
def transformnum (moneyStr) {
def numericStr = moneyStr.replaceAll(/[^\d.]/, '') // 移除非数字字符:ml-citation{ref="5,11" data="citationList"}
def result = numericStr.isNumber() ? numericStr.toBigDecimal() : null // 高精度转换:ml-citation{ref="9,11" data="citationList"}

View File

@@ -68,9 +68,6 @@ group.getField("ISPREPARATION")?.setVisible(false);
## 2. 已改写部分(自动产出)
```groovy
import com.vaadin.ui.Notification;
import com.vaadin.ui.Notification.Type;
final Object table = group.getField("MATERIALDETAILS")?.table;
table?.setImmediate(true);//设置验证
@@ -107,7 +104,6 @@ Object o = table?.getValue();
table.select(o);
}, 1)
import com.dsasp.client.viewframework.util.TableImportExport;
def tie = new TableImportExport(materialList,"com.dsasp.pm.materialmanagertj.client.MaterialApplyDetailImportOfTJ");
tie.addImportButton(4);
tie.addExportButton(5);

View File

@@ -44,9 +44,6 @@ user?.deleteButton.setVisible(false);
## 2. 已改写部分(自动产出)
```groovy
import com.vaadin.ui.Notification;
import com.vaadin.ui.Notification.Type;
final Object table = group.getField("PM_PROJECT_USERS")?.table;

View File

@@ -168,7 +168,6 @@ assetssortId?.setReadOnly(true);
## 2. 已改写部分(自动产出)
```groovy
import com.dsasp.server.common.dataDic.service.POJOCRUDService;
import com.vaadin.ui.PopupDateField;
def value = event.getProperty().getValue();

View File

@@ -177,9 +177,6 @@ invoicelist?.addButton(cb, 0);
```groovy
import com.dsasp.server.common.exception.ValidationException;
import com.dsasp.server.common.util.HTTPClientUtils;
import com.vaadin.ui.Notification;
import com.vaadin.ui.Notification.Type;
def transformnum (moneyStr) {
def numericStr = moneyStr.replaceAll(/[^\d.]/, '') // 移除非数字字符:ml-citation{ref="5,11" data="citationList"}
def result = numericStr.isNumber() ? numericStr.toBigDecimal() : null // 高精度转换:ml-citation{ref="9,11" data="citationList"}

View File

@@ -18,7 +18,6 @@ tie.addExportButton(4);
## 2. 已改写部分(自动产出)
```groovy
import com.dsasp.client.viewframework.util.TableImportExport;
//添加按钮
addSubTableButton("RECORDDETAILS", "SELECT", 0);
//导入按钮

View File

@@ -68,9 +68,6 @@ group.getField("ISPREPARATION")?.setVisible(false);
## 2. 已改写部分(自动产出)
```groovy
import com.vaadin.ui.Notification;
import com.vaadin.ui.Notification.Type;
final Object table = group.getField("MATERIALDETAILS")?.table;
table?.setImmediate(true);//设置验证
@@ -107,7 +104,6 @@ Object o = table?.getValue();
table.select(o);
}, 1)
import com.dsasp.client.viewframework.util.TableImportExport;
def tie = new TableImportExport(materialList,"com.dsasp.pm.materialmanagertj.client.MaterialApplyDetailImportOfTJ");
tie.addImportButton(4);
tie.addExportButton(5);

View File

@@ -44,9 +44,6 @@ user?.deleteButton.setVisible(false);
## 2. 已改写部分(自动产出)
```groovy
import com.vaadin.ui.Notification;
import com.vaadin.ui.Notification.Type;
final Object table = group.getField("PM_PROJECT_USERS")?.table;

View File

@@ -6,8 +6,6 @@
// 余留模式 : 残留字段句柄链(未覆盖动词)
// 处置 : 大部分已自动改写,余留行人工补全(见作业单)
import com.dsasp.viewframework.MultiSelectField;
import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.data.Property.ValueChangeEvent;
final def group1 = group;
if (lists == null) {

View File

@@ -6,12 +6,6 @@
// 余留模式 : raw .table 组件访问; 残留字段句柄链(未覆盖动词)
// 处置 : 大部分已自动改写,余留行人工补全(见作业单)
import com.vaadin.ui.Notification;
import com.vaadin.ui.Notification.Type;
import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.data.Property.ValueChangeEvent;
import com.dsasp.client.viewframework.listener.ConfirmDialogListener;
import com.vaadin.ui.Link;
import com.vaadin.server.ExternalResource;
import com.vaadin.ui.Label;

View File

@@ -5,7 +5,6 @@
// label : FULL_AUTO
// 处置 : 全自动改写完成,直接入 P4 转换流水线
import com.dsasp.server.common.dataDic.service.POJOCRUDService;
import com.vaadin.ui.PopupDateField;
def value = event.getProperty().getValue();

View File

@@ -5,9 +5,6 @@
// label : FULL_AUTO
// 处置 : 全自动改写完成,直接入 P4 转换流水线
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
//将自定义的按钮添加至
addSubTableButton("USERIDS", "SELECT", 0);

View File

@@ -6,8 +6,6 @@
// 余留模式 : 残留字段句柄链(未覆盖动词)
// 处置 : 大部分已自动改写,余留行人工补全(见作业单)
import com.dsasp.viewframework.MultiSelectField;
import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.data.Property.ValueChangeEvent;
final def group1 = group;
if (lists == null) {

View File

@@ -4,8 +4,6 @@
// seq : 1
// label : FULL_AUTO
// 处置 : 全自动改写完成,直接入 P4 转换流水线
import com.vaadin.ui.Button;
//def tList = [];
//
//def results = GetServicesFunction.listSelectResult([:],"HR_WELFARECATEGORY");

View File

@@ -4,9 +4,6 @@
// seq : 1
// label : FULL_AUTO
// 处置 : 全自动改写完成,直接入 P4 转换流水线
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
//将自定义的按钮添加至
addSubTableButton("HR_EMPLOYEES", "SELECT", 0);

View File

@@ -5,9 +5,6 @@
// label : FULL_AUTO
// 处置 : 全自动改写完成,直接入 P4 转换流水线
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
//将自定义的按钮添加至
addSubTableButton("USERIDS", "SELECT", 0);

View File

@@ -4,8 +4,5 @@
// seq : 3
// label : FULL_AUTO
// 处置 : 全自动改写完成,直接入 P4 转换流水线
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
addSubTableButton("SAFETYRECTIFICATIONTERMS", "SELECT", 0);

View File

@@ -8,7 +8,6 @@
addSubTableButton("MATERIALDETAILS", "SELECT", 0);
import com.dsasp.client.viewframework.util.TableImportExport;
def tie = new TableImportExport(materiallist,"com.dsasp.pm.materialmanagertj.client.MaterialRequestMasterPlanDetailImportOfTJ");
group.getField("MATERIALDETAILS").setData(tie);
tie.addImportButton(3);

View File

@@ -5,6 +5,8 @@
// label : FULL_AUTO
// 处置 : 全自动改写完成,直接入 P4 转换流水线
//将自定义的按钮添加至
addSubTableButton("SIGNDETAILS", "SELECT", 0);
addFieldButton("SIGNDETAILS", "全选签到", {

View File

@@ -6,12 +6,6 @@
// 余留模式 : raw .table 组件访问; 残留字段句柄链(未覆盖动词)
// 处置 : 大部分已自动改写,余留行人工补全(见作业单)
import com.vaadin.ui.Notification;
import com.vaadin.ui.Notification.Type;
import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.data.Property.ValueChangeEvent;
import com.dsasp.client.viewframework.listener.ConfirmDialogListener;
import com.vaadin.ui.Link;
import com.vaadin.server.ExternalResource;
import com.vaadin.ui.Label;

View File

@@ -4,7 +4,4 @@
// seq : 2
// label : FULL_AUTO
// 处置 : 全自动改写完成,直接入 P4 转换流水线
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
addSubTableButton("UNITS", "SELECT", 0);

View File

@@ -5,14 +5,10 @@
// label : FULL_AUTO
// 处置 : 全自动改写完成,直接入 P4 转换流水线
/*
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
*/
def inventorydetailslist = getFieldValue("INVENTORYDETAILS");//盘点明细值
//导入功能
import com.dsasp.client.viewframework.util.TableImportExport;
def tie = new TableImportExport(inventorydetails,"com.dsasp.hr.checkattendancemanager.client.CheckinoutImport"){
public void importData(List<Map<String,Object>> datas){
def map = [:];

View File

@@ -7,9 +7,6 @@
// 处置 : 大部分已自动改写,余留行人工补全(见作业单)
import com.dsasp.server.common.exception.ValidationException;
import com.dsasp.server.common.util.HTTPClientUtils;
import com.vaadin.ui.Notification;
import com.vaadin.ui.Notification.Type;
def transformnum (moneyStr) {
def numericStr = moneyStr.replaceAll(/[^\d.]/, '') // 移除非数字字符:ml-citation{ref="5,11" data="citationList"}
def result = numericStr.isNumber() ? numericStr.toBigDecimal() : null // 高精度转换:ml-citation{ref="9,11" data="citationList"}

View File

@@ -5,9 +5,6 @@
// label : PARTIAL
// 余留模式 : raw .table 组件访问; 数据源 addItem(非标准选项 idiom); 残留字段句柄链(未覆盖动词)
// 处置 : 大部分已自动改写,余留行人工补全(见作业单)
import com.vaadin.ui.Notification;
import com.vaadin.ui.Notification.Type;
final Object table = group.getField("MATERIALDETAILS")?.table;
table?.setImmediate(true);//设置验证
@@ -44,7 +41,6 @@ Object o = table?.getValue();
table.select(o);
}, 1)
import com.dsasp.client.viewframework.util.TableImportExport;
def tie = new TableImportExport(materialList,"com.dsasp.pm.materialmanagertj.client.MaterialApplyDetailImportOfTJ");
tie.addImportButton(4);
tie.addExportButton(5);

View File

@@ -4,8 +4,6 @@
// seq : 1
// label : FULL_AUTO
// 处置 : 全自动改写完成,直接入 P4 转换流水线
import com.vaadin.ui.Button;
//def tList = [];
//def results = GetServicesFunction.listSelectResult([:],"HR_WELFARECATEGORY");
//

View File

@@ -5,14 +5,10 @@
// label : FULL_AUTO
// 处置 : 全自动改写完成,直接入 P4 转换流水线
/*
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
*/
def inventorydetailslist = getFieldValue("INVENTORYDETAILS");//盘点明细值
//导入功能
import com.dsasp.client.viewframework.util.TableImportExport;
def tie = new TableImportExport(inventorydetails,"com.dsasp.pm.turnovermaterialmanager.client.TurnOverMaterialInventoryDetailsImport"){
public void importData(List<Map<String,Object>> datas){

View File

@@ -5,9 +5,6 @@
// label : PARTIAL
// 余留模式 : raw .table 组件访问; 残留字段句柄链(未覆盖动词)
// 处置 : 大部分已自动改写,余留行人工补全(见作业单)
import com.vaadin.ui.Notification;
import com.vaadin.ui.Notification.Type;
final Object table = group.getField("PM_PROJECT_USERS")?.table;

View File

@@ -6,7 +6,7 @@
// 处置 : 全自动改写完成,直接入 P4 转换流水线
import com.dsasp.server.common.dataDic.bean.CustomSearchConditional;
def strSql = " P.PROJECTSTAGE>=8 AND P.PROJECTSTAGE <= 100"";
def strSql = " P.PROJECTSTAGE>=8 AND P.PROJECTSTAGE <= 100";
def map = ["PROJECTSTAGE":new CustomSearchConditional(strSql)];
map["FILIALE"] = getFieldValue("ORGID");

View File

@@ -6,7 +6,6 @@
// 余留模式 : 属性数据源链(非 setReadOnly 收尾); 残留字段句柄链(未覆盖动词)
// 处置 : 大部分已自动改写,余留行人工补全(见作业单)
import com.dsasp.server.common.dataDic.service.POJOCRUDService;
import com.vaadin.ui.PopupDateField;
def value = event.getProperty().getValue();

View File

@@ -5,8 +5,6 @@
// label : FULL_AUTO
// 处置 : 全自动改写完成,直接入 P4 转换流水线
import com.dsasp.server.common.dataDic.service.POJOCRUDService;
import com.vaadin.ui.PopupDateField;
def value = event.getProperty().getValue();
////////////////////////////////////////////////////////

View File

@@ -4,8 +4,6 @@
// seq : 1
// label : FULL_AUTO
// 处置 : 全自动改写完成,直接入 P4 转换流水线
import com.vaadin.ui.Button;
//def tList = [];
//def results = GetServicesFunction.listSelectResult([:],"HR_WELFARECATEGORY");
//

View File

@@ -5,6 +5,8 @@
// label : FULL_AUTO
// 处置 : 全自动改写完成,直接入 P4 转换流水线
//将自定义的按钮添加至
//addSubTableButton("TASKS", "SELECT", 0);
addFieldButton("TASKS", "查询", {

View File

@@ -5,8 +5,5 @@
// label : FULL_AUTO
// 处置 : 全自动改写完成,直接入 P4 转换流水线
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
//将自定义的按钮添加至
addSubTableButton("INVOICELIST", "SELECT", 0);

View File

@@ -7,9 +7,6 @@
// 处置 : 大部分已自动改写,余留行人工补全(见作业单)
import com.dsasp.server.common.exception.ValidationException;
import com.dsasp.server.common.util.HTTPClientUtils;
import com.vaadin.ui.Notification;
import com.vaadin.ui.Notification.Type;
def transformnum (moneyStr) {
def numericStr = moneyStr.replaceAll(/[^\d.]/, '') // 移除非数字字符:ml-citation{ref="5,11" data="citationList"}
def result = numericStr.isNumber() ? numericStr.toBigDecimal() : null // 高精度转换:ml-citation{ref="9,11" data="citationList"}

View File

@@ -5,7 +5,6 @@
// label : PARTIAL
// 余留模式 : 残留字段句柄链(未覆盖动词)
// 处置 : 大部分已自动改写,余留行人工补全(见作业单)
import com.dsasp.client.viewframework.util.TableImportExport;
//添加按钮
addSubTableButton("RECORDDETAILS", "SELECT", 0);
//导入按钮

View File

@@ -4,9 +4,6 @@
// seq : 1
// label : FULL_AUTO
// 处置 : 全自动改写完成,直接入 P4 转换流水线
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
//将自定义的按钮添加至
addSubTableButton("DETAILS", "SELECT", 0);

View File

@@ -5,9 +5,6 @@
// label : PARTIAL
// 余留模式 : raw .table 组件访问; 数据源 addItem(非标准选项 idiom); 残留字段句柄链(未覆盖动词)
// 处置 : 大部分已自动改写,余留行人工补全(见作业单)
import com.vaadin.ui.Notification;
import com.vaadin.ui.Notification.Type;
final Object table = group.getField("MATERIALDETAILS")?.table;
table?.setImmediate(true);//设置验证
@@ -44,7 +41,6 @@ Object o = table?.getValue();
table.select(o);
}, 1)
import com.dsasp.client.viewframework.util.TableImportExport;
def tie = new TableImportExport(materialList,"com.dsasp.pm.materialmanagertj.client.MaterialApplyDetailImportOfTJ");
tie.addImportButton(4);
tie.addExportButton(5);

View File

@@ -5,6 +5,8 @@
// label : FULL_AUTO
// 处置 : 全自动改写完成,直接入 P4 转换流水线
//将自定义的按钮添加至
//addSubTableButton("TASKS", "SELECT", 0);
addFieldButton("TASKS", "查询", {

View File

@@ -5,9 +5,6 @@
// label : PARTIAL
// 余留模式 : raw .table 组件访问; 残留字段句柄链(未覆盖动词)
// 处置 : 大部分已自动改写,余留行人工补全(见作业单)
import com.vaadin.ui.Notification;
import com.vaadin.ui.Notification.Type;
final Object table = group.getField("PM_PROJECT_USERS")?.table;

View File

@@ -447,6 +447,24 @@ _NOTIF_IMPORT_RE = re.compile(
re.MULTILINE,
)
# F2-4b 修复: 扩展 import 剥离规则
# 以下类在 EIP4 classpath 不存在,必须剥除否则 Groovy 编译失败
# 规则:Vaadin 客户端类 + com.dsasp.client.* 全剥
# com.dsasp.server.common.util.EnviromentGet 不在 platform-legacy-core,剥
# com.dsasp.server.common.dataDic.* 在 platform-legacy-core 存在,不剥
_VAADIN_EXTRA_IMPORT_RE = re.compile(
r'^[ \t]*import\s+com\.vaadin\.(?:server\.VaadinService|ui\.PopupDateField);\s*\n?',
re.MULTILINE,
)
_DSASP_CLIENT_IMPORT_RE = re.compile(
r'^[ \t]*import\s+com\.dsasp\.client\.[\w\.]+;\s*\n?',
re.MULTILINE,
)
_ENVIROMENT_GET_IMPORT_RE = re.compile(
r'^[ \t]*import\s+com\.dsasp\.server\.common\.util\.EnviromentGet;\s*\n?',
re.MULTILINE,
)
# 匹配: [final] Button VAR = new Button("文案") 或 [def/final] Button VAR = new Button("文案")
_BTN_DECL_RE = re.compile(
r'^[ \t]*(?:final\s+)?(?:def\s+)?Button\s+(\w+)\s*=\s*new\s+Button\((["\'][^"\']+["\'])\)\s*;?[ \t]*(?://[^\n]*)?\n?',
@@ -979,6 +997,13 @@ def rewrite_script(source: str) -> Tuple[str, List[RewriteDetail], str]:
"""
details: List[RewriteDetail] = []
# ── 4.9 原始脚本预处理:修复已知源数据 bug ────────────────────
# F2-4b: 原始脚本中字符串字面量末尾有多余双引号(如 "...SQL 100"";),
# 这是上游数据入库时的编码问题,会导致 Groovy 编译失败。
# 规则:只修复 非空字符串内容(不跨行)后面跟了多余 """ 的模式。
# 关键约束:[^"\n]+ 排除换行,防止跨行匹配到合法的 def sql = ""; 语句。
source = re.sub(r'("[^"\n]+)""(;)', r'\1"\2', source)
# ── 5.0 规则族2: 动态按钮家族(先于 HARD 检测运行)──────────
# new Button + addClickListener + fieldVar.addButton(btnVar, N)
# → addFieldButton("FIELD", "文案", {闭包体}, N)
@@ -1110,10 +1135,21 @@ def rewrite_script(source: str) -> Tuple[str, List[RewriteDetail], str]:
count=opt_count,
))
# ── 5.9 全局 Vaadin import 清理 ──────────────────────────
# ── 5.9 全局 Vaadin/Legacy import 清理 ──────────────────────────
# F2-4: Notification_show / dynamic_button 等规则改写后,vaadin Notification
# import 已无用;在分类前统一剥离,避免引擎编译失败。
working = _NOTIF_IMPORT_RE.sub('', working)
# F2-4b: Button/ClickEvent/ClickListener import 无条件剥除——
# dynamic_button 规则只在 new Button()+addClickListener 形态下改写并剥 import,
# 但 addButton(getField(...),N) 形态不触发改写器,其 Button import 仍残留。
# Button/ClickEvent/ClickListener 在 EIP4 classpath 不存在,统一剥除无副作用。
working = _BTN_IMPORT_RE.sub('', working)
working = _LISTENER_IMPORT_RE.sub('', working)
# F2-4b: 扩展剥离——VaadinService/PopupDateField/dsasp.client.*/EnviromentGet
# 均不在 EIP4 classpath,保留会导致 Groovy MultipleCompilationErrors
working = _VAADIN_EXTRA_IMPORT_RE.sub('', working)
working = _DSASP_CLIENT_IMPORT_RE.sub('', working)
working = _ENVIROMENT_GET_IMPORT_RE.sub('', working)
# ── 5.10 分类 ──────────────────────────────────────────────
if not _has_s3(working):

View File

@@ -123,14 +123,27 @@ def try_get_db_item(tid: str, db_conn) -> dict:
def connect_db():
"""F2-4b 修复:优先连接本地 eip4dev(5433),回退远程 192.168.20.68:5435。"""
try:
import psycopg2
# 优先本地 eip4dev
try:
conn = psycopg2.connect(
host="localhost", port=5433, dbname="eip4dev",
user="eip4", password="", connect_timeout=5,
options="-c search_path=eip3",
)
print(" 数据库连接成功(本地 eip4dev:5433),将抽取真实行数据作 item")
return conn
except Exception:
pass
# 回退远程
conn = psycopg2.connect(
host="192.168.20.68", port=5435, dbname="postgres",
user="ceshi", password="ceshi", connect_timeout=5,
options="-c search_path=eip3",
)
print(" 数据库连接成功,将抽取真实行数据作 item")
print(" 数据库连接成功(远程 192.168.20.68:5435),将抽取真实行数据作 item")
return conn
except Exception as e:
print(f" 数据库不可达 ({e}),item 将使用 {{}}")