根据银行回款信息自动获取金额和客户名称--UI事件-更新事件

/**
 * @author QiaoChu
 * @codeName 根据银行回款信息自动获取金额和客户名称
 * @description 根据银行回款信息自动获取金额和客户名称
 * @createTime 2024-10-22
 * @函数需求编号
 */
//原始银行回款信息
String repayment_info = context.data["repayment_info__c"] as String
//获取银行回款信息
def resultInfo = extractRepaymentInfo(repayment_info)
//客户名称
String payer_account_name = resultInfo['payer_account_name']
//到款金额
String amount_received = resultInfo['amount_received']
//付款方银行
String payer_bank = resultInfo['payer_bank']

def extractRepaymentInfo(String info) {
    String payer_account_name = ''
    String amount_received = ''
    String payer_bank = ''
    // 根据银行类型提取不同信息
    if (info =~ /(?s).*【建设银行】.*/) {
        def matchAccountName = (info =~ /(?s).*对方户名:(.+?)。.*/)
        def matchAmount = (info =~ /(?s).*收入人民币(.+?)元.*/)
        if (matchAccountName.find() && matchAmount.find()) {
            payer_account_name = matchAccountName.group(1).trim() // 使用 group(1)
            amount_received = matchAmount.group(1).trim() // 使用 group(1)
            payer_bank = "建设银行"
        }
    } else if (info =~ /(?s).*【中国农业银行】.*/) {
        def matchAccountName = (info =~ /(?s).*([^\s]+)于.*/)
        def matchAmount = (info =~ /(?s).*金额为(.+?).*/)
        if (matchAccountName.find() && matchAmount.find()) {
            payer_account_name = matchAccountName.group(1).trim() // 使用 group(1)
            amount_received = matchAmount.group(1).trim() // 使用 group(1)
            payer_bank = "中国农业银行"
        }
    } else if (info =~ /(?s).*【交通银行】.*/) {
        def matchAccountName = (info =~ /(?s).*对方户名:(.+?),.*/)
        def matchAmount = (info =~ /(?s).*转入资金(.+?)元.*/)
        if (matchAccountName.find() && matchAmount.find()) {
            payer_account_name = matchAccountName.group(1).trim() // 使用 group(1)
            amount_received = matchAmount.group(1).trim() // 使用 group(1)
            payer_bank = "交通银行"
        }
    } else {
        // 对于不支持的银行类型,返回空字符串
        payer_account_name = ''
        amount_received = ''
        payer_bank = ''
    }
    // 使用 Map 返回结果
    return [payer_account_name: payer_account_name, amount_received: amount_received, payer_bank: payer_bank]
}

UIEvent event = UIEvent.build(context) {
    //主对象修改数据
    editMaster("payer_account_name": payer_account_name, "amount_received": amount_received, "payer_bank": payer_bank)
}
return event

二、数据更新事件
2.1.字段事件。在新建/编辑页,当某一字段修改(值改变且失焦)时,触发自定义函数来更新主对象或从对象的数据。
参考:
配置步骤 | 纷享销客 | 帮助中心

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值