bp_count_query.lsc 2.47 KB
Newer Older
Spencer Chang's avatar
Spencer Chang committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
<?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_count_query() {
                var bp_count_list_details;
                try {
                    //商业伙伴数量统计
                    var bp_count_bm= $bm('app.bp_master.bp_count_query');
                    var bp_count_list_map = bp_count_bm.queryAsMap({
                        user_id:$ctx.parameter.user_id
                    });
                    bp_count_list_details = bp_count_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_count_list: []
                    
                };
                var bp_count_list = result.bp_count_list;
                if (bp_count_list_details) {
                    for (var i = 0;i < bp_count_list_details.length;i++) {
                        var bp_count_list_detail = bp_count_list_details[i];
                        bp_count_list.push({
                            "sum_np": bp_count_list_detail.sum_np,
                            "sum_org": bp_count_list_detail.sum_org,
                            "sum_tenant": bp_count_list_detail.sum_tenant,
                            "sum_agent": bp_count_list_detail.sum_agent,
                            "sum_guarantor": bp_count_list_detail.sum_guarantor,
                            "bp_sum": bp_count_list_detail.bp_sum
                        });
                    }
                }
               
            
                $ctx.parameter.json = JSON.stringify(result);
            }
            if ($ctx.parameter.return_status != 'E'&& $ctx.parameter.return_status != 'TIMEOUT') {
                bp_count_query();
            }
        ]]></s:server-script>
    </a:init-procedure>
    <a:service-output output="/parameter/@json"/>
</a:service>