F2-3:运行时动词闭包子指令机制 + staging 晋级(FULL_AUTO 507/HARD 74)
ScriptFacade:addFieldButton 扩第3参闭包(onClick 子指令数组)+ showConfirm 新动词,服务端急切求值闭包,子指令收进子缓冲,输出嵌套指令 JSON。 前端 scriptCommands.ts/registerReplayAction.ts:处理 addButton onClick/ confirmDialog onOk 嵌套重放,onClickActions/onOkActions 透传给 amis。 ScriptFacadeTest 补 7 个正反例(24/24 全绿)。 staging 晋级:FULL_AUTO 507(+10)/HARD 74(-12)/自动化率 82.7%, 双库各更新 801 条,e2e 30/30 全绿。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,156 @@
|
||||
// === EIP4 P4 脚本迁移产出 ===
|
||||
// template_id : e7670207-9cf7-4db9-a452-884b58408b96
|
||||
// template_name: 付款确认(五建定制)
|
||||
// seq : 7
|
||||
// label : FULL_AUTO
|
||||
// 处置 : 全自动改写完成,直接入 P4 转换流水线
|
||||
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;
|
||||
|
||||
|
||||
//选择付款申请按钮
|
||||
addSubTableButton("DRAFTLIST", "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";//交易类型-背书转让
|
||||
|
||||
//将自定义的按钮添加至
|
||||
addFieldButton("DETAILS", "查询", {
|
||||
// 付款确认-批量转账付款
|
||||
// 验证提醒
|
||||
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);
|
||||
showToast(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")){
|
||||
showToast("发查接口请求超时,请联系管理员",Type.ERROR_MESSAGE);
|
||||
}
|
||||
def tempreturnlist = HTTPClientUtils.jsonStringtoMap(tempresponseBody)?.get("data");
|
||||
Console.debug("发查"+tempreturnlist);
|
||||
if(!tempreturnlist || !tempreturnlist.get("retCode")){
|
||||
showToast("发查接口请求异常,请联系管理员!",Type.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
//得到付款结果
|
||||
def tempretCode = tempreturnlist.get("retCode");
|
||||
if(tempretCode && tempretCode != "0000" && tempreturnlist.get("retMsg")){
|
||||
showToast(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")){
|
||||
showToast("查询接口请求超时,请联系管理员",Type.ERROR_MESSAGE);
|
||||
}
|
||||
def returnlist = HTTPClientUtils.jsonStringtoMap(responseBody)?.get("data");
|
||||
Console.debug("查询"+returnlist);
|
||||
if(!returnlist || !returnlist.get("retCode")){
|
||||
//throw new ValidationException("接口请求异常,请联系管理员!");
|
||||
showToast("接口请求异常,请联系管理员!",Type.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
//得到付款结果
|
||||
def retCode = returnlist.get("retCode");
|
||||
if(retCode && retCode != "0000" && returnlist.get("retMsg")){
|
||||
//throw new ValidationException(returnlist.get("retMsg"));
|
||||
showToast(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);
|
||||
}, 0)
|
||||
Reference in New Issue
Block a user