bill99.lsc 5 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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
<?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);
            
            function getdate() {
                var now = new Date()
                y = now.getFullYear()
                m = now.getMonth() + 1
                d = now.getDate()
                h = now.getHours()
                mi = now.getMinutes()
                ss = now.getSeconds()
                m = m < 10 ? "0" + m : m
                d = d < 10 ? "0" + d : d
                h = h < 10 ? "0" + h : h
                mi = mi < 10 ? "0" + mi : mi
                ss = ss < 10 ? "0" + ss : ss
                return y + "" + m + "" + d + "" + h + "" + mi + "" + ss
            }
            
            var locations = ["classpath:client.xml", "classpath:context/client-demo-servlet.xml"];
            
            var ctx = new FileSystemXmlApplicationContext(locations);
            var checkRealTime = ctx.getBean("testRealTimeQuery");
            var testRealTime = ctx.getBean("testRealTime");
            var debit_number = "";
            var v_flag = "N";
            //插入接口数据
            //$bm('csh.CSH600.hls_create_ebank_data').execute();
            var bm = $bm('csh.CSH600.hls_ebank_interface_v');
            var records = bm.queryAsMap({
                trs_status: 'NEW',
                interface_id: $ctx.parameter.interface_id
            }).getChildren();
            
            for (var i = 0;i < records.length;i++) {
                
                
                if (records[i].debit_number != null) {
                    //zhshi:10023576511
                    var check_result = checkRealTime.testPkiQuery("1", "20023576511", "2002357651101", records[i].debit_number);
                    //解析接口数据
                    var res = $bm('csh.CSH600.hls_check_ebank_data').execute({
                        response_xml: check_result,
                        function_name: 'NC_EMBK_CHECK_PARSE',
                        request_id: '111',
                        interface_id: records[i].interface_id
                    });
                    v_flag = $ctx.parameter.flag;
                    debit_number = records[i].debit_number;
                }else{
                    
                    debit_number = getdate() + "" + records[i].interface_id;
                    
                }
                
                println('--------------------------');
                var res = $bm('csh.CSH600.hls_check_ebank_data').insert({
                    interface_id: records[i].interface_id,
                    debit_number : debit_number
                });
                println($ctx.parameter.flag);
            
                //未传送执行传送
                if (v_flag == 'N') {
                    /*   var result = testRealTime.testSignSinglePKI(String InputCharset,
                     String ContractId,
                     String MemberCode,
                     String MerchantAcctId,
                     String Mechantcontractno,
                     String seqId,
                     String BankAcctName,
                     String BankAcctId,
                     String Amount,
                     String Usage,
                     String CurType,
                     String Remark) */
                    var result = testRealTime.testSignSinglePKI("1", "K14-2000-3113", //
                    "10023576511", "1002357651101", records[i].protocol_number, //协议号
                    debit_number, //
                    records[i].cltnam, records[i].accnbr, records[i].trsamt, records[i].memo, records[i].currency, records[i].memo);
                    //records[i].memo, //用途代码--
                    // var result = testRealTime.testSignSinglePKI("1", "steven04","10023576511", "1002357651101", "BCOMQDSuc1", "2011080101565", "缴紫", "360502198904050392", "20", "代扣", "CNY", "");
                    //解析接口数据
                    $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
                    });
                }
            }
            //核销操作
            $bm('csh.CSH600.hls_writeoff_ebank_data').execute();
        ]]></s:server-script>
    </a:init-procedure>
    <!--     <a:service-output output="/parameter"/> -->
</a:service>