<?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 bp_master_query() {
                var bpMaster_list_details;
               
                try {
                    var bpMaster_list_bm = $bm('app.bp_master.bp_id_query');
                   
                    var bpMaster_list_map = bpMaster_list_bm.queryAsMap({
                        business_license_num: $ctx.parameter.business_license_num,
						bp_name:$ctx.parameter.bp_name, 
						id_card_no:$ctx.parameter.id_card_no
                    });
                    bpMaster_list_details = bpMaster_list_map.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,
                    bp_id_list: []
                };
                var bp_id_list = result.bp_id_list;
              if (bpMaster_list_details) {
                    for (var i = 0;i < bpMaster_list_details.length;i++) {
                         var bpmaster_list_detail = bpMaster_list_details[i];
                        bp_id_list.push({
                            "bp_id": String(bpmaster_list_detail.bp_id)
                        });
                    }
            }
                
              
                $ctx.parameter.json = JSON.stringify(result);
            }
            if ($ctx.parameter.return_status != 'E' && $ctx.parameter.return_status != 'TIMEOUT') {
                bp_master_query();
            }
        ]]></s:server-script>
    </a:init-procedure>
    <a:service-output output="/parameter/@json"/>
</a:service>