任务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>
165 lines
9.0 KiB
Groovy
165 lines
9.0 KiB
Groovy
// === EIP4 P4 脚本迁移产出 ===
|
||
// template_id : e7670207-9cf7-4db9-a452-884b58408b96
|
||
// template_name: 付款确认(五建定制)
|
||
// seq : 1
|
||
// label : HARD
|
||
// 硬 S3 原因 : 动态创建 Vaadin 组件
|
||
// 处置 : 原文保留,进人工排期(amis dialog/service 重写)
|
||
import com.vaadin.ui.Button;
|
||
import com.vaadin.ui.Button.ClickEvent;
|
||
import com.vaadin.ui.Button.ClickListener;
|
||
import com.vaadin.ui.Notification;
|
||
import com.vaadin.ui.Notification.Type;
|
||
import com.dsasp.server.common.exception.ValidationException;
|
||
import com.dsasp.server.common.util.HTTPClientUtils;
|
||
|
||
|
||
//选择付款申请按钮
|
||
group.getField("DRAFTLIST")?.addButton(group.getField("SELECT"),0);
|
||
|
||
|
||
/** 页面必填项:客户号(默认)、单位编码(默认)、账号集合、交易类型(默认背书转让)、发查标识(宁波银行账号送 1:查询;非宁波银行账号送0:发查时向开户行同步票据信息)、
|
||
* 票据种类(107:银承108:商承)
|
||
根据接口返回结果(可否转让、可否拆分、操作状态为可交易的票据),带出票据(包)号、子票区间、票据(包)金额,获取可发起背书转让业务的票据列表,
|
||
并从接口返回的票据信息中选取票据发起背书转让申请
|
||
**/
|
||
|
||
//参数配置
|
||
def custId = GetDefaultValueFunction.getConfigValue("com.dsasp.pm.bankWJ.custId");//客户号-银行提供
|
||
def url = GetDefaultValueFunction.getConfigValue("com.dsasp.pm.bankWJ.IPpath");//客户ip接口访问地址
|
||
def transType = "4";//交易类型-背书转让
|
||
|
||
final Button search = new Button("查询");
|
||
search?.addClickListener(new ClickListener() {
|
||
public void buttonClick(ClickEvent event) {
|
||
// 付款确认-批量转账付款
|
||
// 验证提醒
|
||
def content = "";
|
||
def corpCode = getFieldValue("CORPCODE");//客户在财资设置的四位单位编码
|
||
if(corpCode==null){
|
||
content += "单位编码不能为空!\n";
|
||
}
|
||
def accountnumber = getFieldValue("ACCOUNTNUMBER");//银行账号
|
||
if(accountnumber==null){
|
||
content += "银行账号不能为空!\n";
|
||
}
|
||
def syncFlag = getFieldValue("SYNCFLAG");//发查标识
|
||
if(syncFlag==null){
|
||
content += "发查标识不能为空!\n";
|
||
}
|
||
def draftType = getFieldValue("DRAFTTYPE");//票据种类
|
||
if(draftType==null){
|
||
content += "票据种类不能为空!\n";
|
||
}
|
||
if(content !=null && content !=""){
|
||
//throw new ValidationException(content);
|
||
Notification.show(content,Type.ERROR_MESSAGE);
|
||
return;
|
||
}
|
||
|
||
def accountList = [];//账号列表
|
||
accountList.add(accountnumber);
|
||
|
||
def params = [:];
|
||
def paramsData = [:];
|
||
paramsData["custId"] = custId;
|
||
paramsData["corpCode"] = corpCode;
|
||
paramsData["accountList"] = accountList;
|
||
paramsData["draftType"] = draftType.toString();
|
||
paramsData["transType"] = transType;
|
||
paramsData["registerDateStart"] = GetValueFunction.dateFormate(getFieldValue("REGISTERDATESTART"),"YYYY-MM-dd");//出票日期起日
|
||
paramsData["registerDateEnd"] = GetValueFunction.dateFormate(getFieldValue("REGISTERDATEEND"),"YYYY-MM-dd");//出票日期止日
|
||
paramsData["endDateStart"] = GetValueFunction.dateFormate(getFieldValue("ENDDATESTART"),"YYYY-MM-dd");//到期日期起日
|
||
paramsData["endDateEnd"] = GetValueFunction.dateFormate(getFieldValue("ENDDATEEND"),"YYYY-MM-dd");//到期日期止日
|
||
paramsData["moneyStart"] = getFieldValue("MONEYSTART")?.setScale(2)?.toString();//票面金额起
|
||
paramsData["moneyEnd"] = getFieldValue("MONEYEND")?.setScale(2)?.toString();//票面金额止
|
||
//非宁波银行先发查再查询
|
||
if(syncFlag == 0){
|
||
def tempparams = [:];
|
||
paramsData["syncFlag"] = syncFlag.toString();
|
||
tempparams["Data"] = paramsData;
|
||
tempparams["productName"] = "tmsNewBill";
|
||
tempparams["serviceName"] = "queryApplyInfo";
|
||
def tempdataJson = HTTPClientUtils.jsonToString(tempparams);
|
||
def tempresponseBody = HTTPClientUtils.sendPostRequest(url,tempdataJson,null,null,null);
|
||
if(!tempresponseBody.contains("retCode")){
|
||
Notification.show("发查接口请求超时,请联系管理员",Type.ERROR_MESSAGE);
|
||
}
|
||
def tempreturnlist = HTTPClientUtils.jsonStringtoMap(tempresponseBody)?.get("data");
|
||
Console.debug("发查"+tempreturnlist);
|
||
if(!tempreturnlist || !tempreturnlist.get("retCode")){
|
||
Notification.show("发查接口请求异常,请联系管理员!",Type.ERROR_MESSAGE);
|
||
return;
|
||
}
|
||
//得到付款结果
|
||
def tempretCode = tempreturnlist.get("retCode");
|
||
if(tempretCode && tempretCode != "0000" && tempreturnlist.get("retMsg")){
|
||
Notification.show(tempreturnlist.get("retMsg"),Type.ERROR_MESSAGE);
|
||
return;
|
||
}
|
||
}
|
||
paramsData["syncFlag"] = "1";//默认查询-写死
|
||
params["Data"] = paramsData;
|
||
params["productName"] = "tmsNewBill";
|
||
params["serviceName"] = "queryApplyInfo";
|
||
def dataJson = HTTPClientUtils.jsonToString(params);
|
||
Console.debug(dataJson);
|
||
|
||
/** 查询票据申请 **/
|
||
def signdetails = [];
|
||
def responseBody = HTTPClientUtils.sendPostRequest(url,dataJson,null,null,null);
|
||
if(!responseBody.contains("retCode")){
|
||
Notification.show("查询接口请求超时,请联系管理员",Type.ERROR_MESSAGE);
|
||
}
|
||
def returnlist = HTTPClientUtils.jsonStringtoMap(responseBody)?.get("data");
|
||
Console.debug("查询"+returnlist);
|
||
if(!returnlist || !returnlist.get("retCode")){
|
||
//throw new ValidationException("接口请求异常,请联系管理员!");
|
||
Notification.show("接口请求异常,请联系管理员!",Type.ERROR_MESSAGE);
|
||
return;
|
||
}
|
||
//得到付款结果
|
||
def retCode = returnlist.get("retCode");
|
||
if(retCode && retCode != "0000" && returnlist.get("retMsg")){
|
||
//throw new ValidationException(returnlist.get("retMsg"));
|
||
Notification.show(returnlist.get("retMsg"),Type.ERROR_MESSAGE);
|
||
return;
|
||
}else if(retCode && retCode == "0000"){
|
||
//查询票据查询明细表中是否存在该信息,存在则删除后再新增,不存在则新增
|
||
def PROJECTIDAPIBATCHNO = getFieldValue("PROJECTID")+"-"+getFieldValue("APIBATCHNO");
|
||
def sql = " SELECT PM_ENDORSEAPPLY_ENDORSEDETAILS_ID FROM PM_ENDORSEAPPLY_ENDORSEDETAILS WHERE PROJECTIDAPIBATCHNO = '"+PROJECTIDAPIBATCHNO+"'";
|
||
def list = GetServicesFunction.listSelectResultBySql([:],"PM_ENDORSEAPPLY_ENDORSEDETAILS",sql,["PM_ENDORSEAPPLY_ENDORSEDETAILS_ID"]);
|
||
if(list && list.size()>0){
|
||
list.each{
|
||
def tempmap = [:];
|
||
tempmap["PM_ENDORSEAPPLY_ENDORSEDETAILS_ID"] = it.get_Value("PM_ENDORSEAPPLY_ENDORSEDETAILS_ID");//主键
|
||
GetServicesFunction.excuteFlow(tempmap,"PM_ENDORSEAPPLY_ENDORSEDETAILS_DELETE");
|
||
}
|
||
};
|
||
Console.debug(returnlist.get("draftList"));
|
||
def rows = returnlist.get("draftList");
|
||
for (int i = 0; i < rows?.size(); i++) {
|
||
def it = rows.get(i);
|
||
def itemMap = [:];
|
||
itemMap["DRAFTCODE"] = it.get("draftCode");//票据(包)号
|
||
itemMap["CHILDRANGE"] = it.get("childRange");// 子票区间
|
||
//itemMap["SYNCFLAG"] = it.get("draftType");//票据种类
|
||
itemMap["SYNCFLAG"] = draftType;//票据种类
|
||
itemMap["DRAFTAMOUNT"] = it.get("draftAmount").toBigDecimal();//票据(包)金额
|
||
itemMap["EXCHANGEFLAG"] = it.get("exchangeFlag") ? (it.get("exchangeFlag") == "EM00" ? 1 : 0) : null;//可否转让-EM00:可再转让 EM01:不得转让
|
||
itemMap["ISSPLIT"] = it.get("isSplit") ? (it.get("isSplit") == "0" ? 0 : 1) : null;//可否拆分
|
||
itemMap["OPERATESTATUS"] = it.get("operateStatus") ? (it.get("operateStatus") == "0" ? "可交易" : "等待复核") : null;//操作状态 0:可交易 1:等待复核
|
||
itemMap["REGISTERDATE"] = GetValueFunction.toDate(it.get("registerDate"),"YYYY-MM-dd");//出票日
|
||
itemMap["ENDDATE"] = GetValueFunction.toDate(it.get("endDate"),"YYYY-MM-dd");//到期日
|
||
signdetails.add(itemMap);
|
||
//新增存储查询出来的数据(提交时再清空)
|
||
itemMap["PROJECTIDAPIBATCHNO"] = PROJECTIDAPIBATCHNO;
|
||
GetServicesFunction.excuteFlow(itemMap,"PM_ENDORSEAPPLY_ENDORSEDETAILS_ADD");
|
||
}
|
||
};
|
||
bindField("DETAILS",signdetails);
|
||
}
|
||
});
|
||
//将自定义的按钮添加至
|
||
def details = group.getField("DETAILS");
|
||
details?.addButton(search, 0); |