<?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 lov_list_details;
                try {
                    var lov_list_bm = $bm('app.lov.app_hls_product_plan_list');
                    var lov_list_map = lov_list_bm.queryAsMap({
                        down_payment_ratio: $ctx.parameter.down_payment_ratio,
                        deposit_ratio: $ctx.parameter.deposit_ratio,
                        balloon_ratio: $ctx.parameter.balloon_ratio,
                        times: $ctx.parameter.times
                    });
                    lov_list_details = lov_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,
                    product_plan_list: []
                };
                var product_plan_list = result.product_plan_list;
                if (lov_list_details) {
                    for (var i = 0;i < lov_list_details.length;i++) {
                        var lov_list_detail = lov_list_details[i];
                        product_plan_list.push({
                            "product_plan_id": lov_list_detail.product_plan_id,
                            "product_type_n": lov_list_detail.product_type_n,
                            "product_name": lov_list_detail.product_name,
                            "lease_charge_ratio": lov_list_detail.lease_charge_ratio,
                            "customer_ratio": lov_list_detail.customer_ratio,
                            "down_payment_ratio_from": lov_list_detail.down_payment_ratio_from,
                            "down_payment_ratio_to": lov_list_detail.down_payment_ratio_to,
                            "deposit_ratio_from": lov_list_detail.deposit_ratio_from,
                            "deposit_ratio_to": lov_list_detail.deposit_ratio_to,
                            "balloon_ratio_from": lov_list_detail.balloon_ratio_from,
                            "balloon_ratio_to": lov_list_detail.balloon_ratio_to,
                            "times_from": lov_list_detail.times_from,
                            "times_to": lov_list_detail.times_to,
                            "product_name_write": lov_list_detail.product_name_write
                        });
                    }
                }
            
                $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>
