<?xml version="1.0" encoding="UTF-8"?>
<a:service xmlns:s="leaf.plugin.script" xmlns:a="http://www.leaf-framework.org/application" trace="true">
    <!-- <a:screen xmlns:c="leaf.application.action" xmlns:s="leaf.plugin.script" xmlns:w="leaf.plugin.export.word" xmlns:a="http://www.leaf-framework.org/application" xmlns:p="uncertain.proc" customizationEnabled="true" trace="true"> -->
    <a:init-procedure>
        <s:server-script><![CDATA[
            importPackage(Packages.com.test); //相当于java中的import com.esa2000.*;
            importPackage(Packages.org.springframework.context);
            importPackage(Packages.org.springframework.context.support);
            importPackage(java.io);
            
            
            var locations = ["classpath:client.xml", "classpath:context/client-demo-servlet.xml"];
            var ctx = new FileSystemXmlApplicationContext(locations);
            var testRealTime = ctx.getBean("testRealTime");
            var bm = $bm('cont.CON591.con_contract');
            var records = bm.queryAsMap({
                pki_status: '2,4',
                contract_id: $ctx.parameter.contract_id
            }).getChildren();
            
            for (var i = 0;i < records.length;i++) {
            
              
                //CMB6226022818321234
                //var check_result = testRealTime.testMerchantContractQuery("1", "10023576511","CMB6226022818321234");
                var check_result = testRealTime.testMerchantContractQuery("1", "10023576511",records[i].protocol_number);

                 $bm('csh.CSH600.hls_protocol_ebank_data').execute({
                        response_xml: check_result,
                        function_name: 'NC_EMBK_PROTOCOL_PARSE',
                        request_id: '111',
                        contract_id: records[i].contract_id,
                        protocol_number: records[i].protocol_number
                    });
                //println(res.flag);
                var v_flag = $ctx.parameter.flag;
                println($ctx.parameter.flag);
            
            /*     //未传送执行传送
                if (v_flag == 'N') {
        
                    var result = testRealTime.testSignPKI("1", "1", //
                    "10023576511", "K14-2000-3113",
                    records[i].interface_id, //
                    "BCOMQDSuc2",
                     "BCOM",
                     "0201",//公私
                     records[i].AcctCode,//
                     records[i].AcctName,
                     "101",
                      records[i].IdCode, 
                      records[i].Mobile,
                      "10", "100");
                    //解析接口数据
                    $bm('csh.CSH600.hls_writeoff_ebank_data').update({
                        response_xml: result,
                        function_name: 'NC_EMBK_PARSE',
                        request_id: '111',
                        interface_id: records[i].interface_id
                    });
                } */
            }
        ]]></s:server-script>
    </a:init-procedure>
    <!--     <a:service-output output="/parameter"/> -->
</a:service>