<?xml version="1.0" encoding="UTF-8"?>
<a:service xmlns:ns1="leaf.application.action" xmlns:p="uncertain.proc" xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script" trace="true">
    <a:init-procedure>
        <s:server-script import="app/app_login_check.js"><![CDATA[
         function project_build_query() {
                var company_list_details;
                
                try {
                    
                     var bp_class_bm1= $bm('app.workflow.wfl_pay_query');
                     var bp_class_list_map1 = bp_class_bm1.queryAsMap({  
                         
                        pagesize: $ctx.parameter.pagesize,
                        offsize: $ctx.parameter.offsize,
                        searchInput: $ctx.parameter.searchInput,
                        payment_req_number: $ctx.parameter.payment_req_number,
                        payment_req_id: $ctx.parameter.payment_req_id,
                        contract_number: $ctx.parameter.contract_number,
                        bp_id_tenant_n: $ctx.parameter.bp_id_tenant_n,
                        req_date_from: $ctx.parameter.req_date_from,
                        req_date_to: $ctx.parameter.req_date_to
                    });
                    company_list_details = bp_class_list_map1.getChildren();
                    
                    
                    $ctx.parameter.return_status = 'S';
                    $ctx.parameter.return_message = '执行成功';
                } catch (e) {
                    $ctx.success = "true";
                    $ctx.parameter.return_status = 'E';
                    $ctx.parameter.return_message = String(e);
                }
            
                var result = {
                    result: $ctx.parameter.return_status,
                    message: $ctx.parameter.return_message,
                    pay_request_list:[]
                };
               
           
                
                var pay_request_list = result.pay_request_list;
                if (company_list_details) {
                    for (var i = 0;i < company_list_details.length;i++) {
                        var bp_class_list_detail1 = company_list_details[i];
                        pay_request_list.push({
                            "payment_req_number": bp_class_list_detail1.payment_req_number,
                            "req_date": bp_class_list_detail1.req_date,
                            "contract_number": bp_class_list_detail1.contract_number,
                            "bp_id_tenant_n": bp_class_list_detail1.bp_id_tenant_n,
                            "payment_req_id": bp_class_list_detail1.payment_req_id,
                            "bp_name": bp_class_list_detail1.bp_name,
                             "cdd_list_id": bp_class_list_detail1.cdd_list_id,
                            "bp_bank_account_name": bp_class_list_detail1.bp_bank_account_name,
                            "bp_bank_account_num": bp_class_list_detail1.bp_bank_account_num,
                            "amount": bp_class_list_detail1.amount
                        });
                    }
                }
                
               
                $ctx.parameter.json = JSON.stringify(result);
            }
            if ($ctx.parameter.return_status != 'E'&& $ctx.parameter.return_status != 'TIMEOUT') {
                project_build_query();
            }   
        ]]></s:server-script>
    </a:init-procedure>
    <a:service-output output="/parameter/@json"/>
</a:service>