<?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 lov_query() {
                var bp_academic_bankground_list_details; //ACADEMIC_BACKGROUND
                var bp_source_of_income_list_details; //SOURCE_OF_INCOME_DB
                var bp_relationship_list_details; //RELATIONSHIP
                var bp_flg_guarantor_list_details;
            
                try {
                    var bp_academic_bankground_list_bm = $bm('app.lov.app_bp_academic_bankground_list');
                    var bp_source_of_income_list_bm = $bm('app.lov.app_bp_source_of_income_list');
                    var bp_relationship_list_bm = $bm('app.lov.app_bp_relationship_list');
                    var bp_flg_guarantor_list_bm = $bm('app.lov.app_bp_flg_guarantor_list');
            
                    var bp_academic_bankground_list_map = bp_academic_bankground_list_bm.queryAsMap();
                    var bp_source_of_income_list_map = bp_source_of_income_list_bm.queryAsMap();
                    var bp_relationship_list_map = bp_relationship_list_bm.queryAsMap();
                    var bp_flg_guarantor_list_map = bp_flg_guarantor_list_bm.queryAsMap();
            
                    bp_academic_bankground_list_details = bp_academic_bankground_list_map.getChildren();
                    bp_source_of_income_list_details = bp_source_of_income_list_map.getChildren();
                    bp_relationship_list_details = bp_relationship_list_map.getChildren();
                    bp_flg_guarantor_list_details = bp_flg_guarantor_list_map.getChildren();
            
                    $ctx.parameter.return_status = 'S';
                    $ctx.parameter.return_message = '执行成功';
                } catch (e) {
                    $ctx.parameter.return_status = 'E';
                    $ctx.parameter.return_message = String(e);
                }
            
            
                var result = {
                    result: $ctx.parameter.return_status,
                    message: $ctx.parameter.return_message,
                    bp_academic_bankground_list: [],
                    bp_source_of_income_list: [],
                    bp_relationship_list: [],
                    bp_flg_guarantor_list: []
            
                };
                var bp_academic_bankground_list = result.bp_academic_bankground_list;
                var bp_source_of_income_list = result.bp_source_of_income_list;
                var bp_relationship_list = result.bp_relationship_list;
                var bp_flg_guarantor_list = result.bp_flg_guarantor_list;
            
            
                for (var i = 0;i < bp_academic_bankground_list_details.length;i++) {
                    var bp_academic_bankground_list_detail = bp_academic_bankground_list_details[i];
                    bp_academic_bankground_list.push({
                        "code": bp_academic_bankground_list_detail.code,
                        "name": bp_academic_bankground_list_detail.name
                    });
                }
            
                for (var i = 0;i < bp_source_of_income_list_details.length;i++) {
                    var bp_source_of_income_list_detail = bp_source_of_income_list_details[i];
                    bp_source_of_income_list.push({
                        "code": bp_source_of_income_list_detail.code,
                        "name": bp_source_of_income_list_detail.name
                    });
                }
            
                for (var i = 0;i < bp_relationship_list_details.length;i++) {
                    var bp_relationship_list_detail = bp_relationship_list_details[i];
                    bp_relationship_list.push({
                        "code": bp_relationship_list_detail.code,
                        "name": bp_relationship_list_detail.name
                    });
                }
                for (var i = 0;i < bp_flg_guarantor_list_details.length;i++) {
                    var bp_flg_guarantor_list_detail = bp_flg_guarantor_list_details[i];
                    bp_flg_guarantor_list.push({
                        "code": bp_flg_guarantor_list_detail.code,
                        "name": bp_flg_guarantor_list_detail.name
                    });
                }
            
            
                $ctx.parameter.json = JSON.stringify(result);
            }
            
            if ($ctx.parameter.return_status != 'E'&& $ctx.parameter.return_status != 'TIMEOUT') {
                lov_query();
            }
        ]]></s:server-script>
    </a:init-procedure>
    <a:service-output output="/parameter/@json"/>
</a:service>
