P4-2 脚本迁移线:全量改写产出 + facade 动词表运行时实现

任务1 全量改写执行:
- run_rewrite.py 对客户库缓存 1,427 条逐条改写,按 template_id+脚本序号落盘
  output/rewritten/(497 FULL_AUTO + 30 PARTIAL + 85 HARD + 815 NO_S3)
- 人工作业单 115 份(PARTIAL 30 + HARD 85),每份附原文/已改部分/余留模式/建议改法/工时口径
- 自动化率 81.2% 复现 C4 实测,0 误改

任务2 facade 动词表运行时:
- ScriptFacade 把 31 改写目标动词 + bindField 作为 Groovy 闭包注入 Bindings
  (PoC enableButton 模式扩展);服务端语义动词直接求值,UI 语义动词捕获为
  amis 事件动作指令 JSON(actionType/componentId/args)
- 保真层纪律:全在 com.eip4 现代层,com.dsasp 源码零改,ArchUnit 复跑通过
- ScriptExecuteController 提供 /api/script/execute 与 /api/script/execute-template

验证:
- 单测 17 方法逐动词覆盖,均经真实 Groovy 过保真层引擎,BUILD SUCCESS
- 集成 6 条真实 FULL_AUTO 改写脚本经 8086 执行,amis 指令协议合规
- 回归 PoC script-test 通过,ArchUnit 架构纪律通过

报告 tools/s3_rewriter/P4脚本迁移执行报告.md;新坑入 docs/迁移手册.md 5.39/9.3

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-06-11 16:10:22 +08:00
parent 3a13c50a01
commit aefb0e2eb9
1552 changed files with 41290 additions and 2 deletions

View File

@@ -0,0 +1,95 @@
// === EIP4 P4 脚本迁移产出 ===
// template_id : 745c9534-c755-4ef5-bc26-8b78a802ec4a
// template_name: 验工月报区间
// seq : 1
// label : PARTIAL
// 余留模式 : 残留字段句柄链(未覆盖动词)
// 处置 : 大部分已自动改写,余留行人工补全(见作业单)
import com.dsasp.server.common.dataDic.service.POJOCRUDService;
//--设置年份下拉框默认值--
//获取组件(年份)
clearFieldData("YEAR");
def currentYear = GetDefaultValueFunction.currentYear();
//设置开始年份和结束年份
def startYear = currentYear - 4;
def endYear = currentYear + 11;
for(i in startYear..&lt;endYear){
addFieldOption("YEAR", i, i.toString());
}
//--设置月份下拉框默认值--
clearFieldData("MONTH");
def currentMonth = GetDefaultValueFunction.currentMonth();
for(j in 1..12){
addFieldOption("MONTH", j, j.toString());
}
//--设置默认显示的年份、月份、开始日期、结束日期--
def startDate = group.getField("STARTDATE");
def endDate = group.getField("ENDDATE");
def monthReportMap = [:];
monthReportMap["PROJECTID"] = getFieldValue("PROJECTID");
monthReportMap[POJOCRUDService.ORDER] = " order by endDate DESC limit 1";
def monthReportList = GetServicesFunction.listSelectResult(monthReportMap,"PM_MREPORTINTERVAL");
if(monthReportList != null){
//设置年份、月份
def data = monthReportList.get(0).toMap();
def lastYear = data.get("YEAR");
def lastMonth = data.get("MONTH");
if(lastMonth == 12){
setFieldConvertedValue("YEAR", lastYear + 1);
setFieldConvertedValue("MONTH", 1);
}else{
setFieldConvertedValue("YEAR", lastYear);
setFieldConvertedValue("MONTH", lastMonth + 1);
}
//设置开始日期、结束日期
startDate = GetValueFunction.addDays(data.get("ENDDATE"),1);
endDate = GetValueFunction.addMonths(data.get("ENDDATE"),1);
if(GetValueFunction.monthOF(endDate) == 12){
endDate = GetValueFunction.lastDateOfMonth(endDate);
}
bindField("STARTDATE", startDate);
bindField("ENDDATE", endDate);
setFieldReadOnly("STARTDATE",true);
}else{
def projectList = GetServicesFunction.listSelectResult(["PM_PROJECT_ID":getFieldValue("PROJECTID")],"PM_PROJECT");
if(projectList != null){
def projectMap = projectList.get(0).toMap();
if(projectMap.get("ACTUALSTARTDATE") != null){
setFieldConvertedValue("YEAR", GetValueFunction.yearOf(projectMap.get("ACTUALSTARTDATE")));
setFieldConvertedValue("MONTH", GetValueFunction.monthOF(projectMap.get("ACTUALSTARTDATE")));
startDate = projectMap.get("ACTUALSTARTDATE");
endDate = GetValueFunction.addMonths(projectMap.get("ACTUALSTARTDATE"),1);
endDate = GetValueFunction.addDays(endDate,-1);
bindField("STARTDATE", startDate);
bindField("ENDDATE", endDate);
}
else{
setFieldConvertedValue("YEAR", currentYear);
setFieldConvertedValue("MONTH", currentMonth);
}
}else{
setFieldConvertedValue("YEAR", currentYear);
setFieldConvertedValue("MONTH", currentMonth);
}
setFieldReadOnly("STARTDATE",false);
}

View File

@@ -0,0 +1,27 @@
// === EIP4 P4 脚本迁移产出 ===
// template_id : 745c9534-c755-4ef5-bc26-8b78a802ec4a
// template_name: 验工月报区间
// seq : 2
// label : NO_S3
// 处置 : 无 S3 模式,原样进 P4
def strMReportIntervalid = item['PM_MREPORTINTERVAL_ID'];
if(strMReportIntervalid != null)
{
def strSql = "SELECT Count(*) FROM PM_MREPORTINTERVAL";
strSql += " WHERE projectid = '" + GetDefaultValueFunction.getCurrentProjectId() + "'";
strSql += " AND enddate &gt; (SELECT enddate FROM PM_MREPORTINTERVAL";
strSql += " WHERE projectid = '" + GetDefaultValueFunction.getCurrentProjectId() + "'";
strSql += " AND PM_MREPORTINTERVAL_ID = '" + strMReportIntervalid + "')";
def count = GetServicesFunction.findCount(strSql);
if(count != 0){//选中的记录已被现场材料进场功能引用
enableButton("修改",false);//修改不可用
enableButton("删除",false);//删除不可用
}else{
enableButton("修改",true);//修改可用
enableButton("删除",true);//删除可用
}
}

View File

@@ -0,0 +1,44 @@
// === EIP4 P4 脚本迁移产出 ===
// template_id : 745c9534-c755-4ef5-bc26-8b78a802ec4a
// template_name: 验工月报区间
// seq : 3
// label : FULL_AUTO
// 处置 : 全自动改写完成,直接入 P4 转换流水线
//在下拉列表框调用removeAllItems()方法前,应清空下拉列表中的值,之后赋值才能生效
bindField("YEAR",null);
bindField("MONTH",null);
//--设置年份下拉框默认值--
//获取组件(年份)
clearFieldData("YEAR");
def currentYear = GetDefaultValueFunction.currentYear();
//设置开始年份和结束年份
def startYear = currentYear - 4;
def endYear = currentYear + 11;
for(i in startYear..&lt;endYear){
addFieldOption("YEAR", i, i.toString());
}
//--设置月份下拉框默认值--
clearFieldData("MONTH");
def currentMonth = GetDefaultValueFunction.currentMonth();
for(j in 1..12){
addFieldOption("MONTH", j, j.toString());
}
//获取当前选中月报区间年份和月份数,赋值至年份、月份下拉列表框
def selMonthReportList = GetServicesFunction.listSelectResult(["PM_MREPORTINTERVAL_ID":getFieldValue("PM_MREPORTINTERVAL_ID")],"PM_MREPORTINTERVAL");
if(selMonthReportList != null){
def selMonthReportMap = selMonthReportList.get(0).toMap();
bindField("YEAR",selMonthReportMap.get("YEAR"));
bindField("MONTH",selMonthReportMap.get("MONTH"));
}