<?xml version="1.0" encoding="UTF-8"?> <!-- $Author: gaoyang $Date: 2015-4-13 下午05:06:40 $Revision: 1.0 $Purpose: --> <a:service xmlns:s="leaf.plugin.script" xmlns:a="http://www.leaf-framework.org/application" xmlns:p="uncertain.proc" trace="true"> <a:init-procedure> <s:server-script><![CDATA[ /** *read me *1.bm部分需改为相应系统的逻辑,此处逻辑为hr系统,仅供参考 *2.session、cookie部分不用修改,如果出现session、cookie方面的问题,可检查此处的session、cookie(如'/session/@session_id'是否有值) *3.调试函数:println(Object);会将Object打印在控制台(如应用服务器tomcat的控制台)。例如:println($session.toXML());会将session对象以xml格式打印出来。 */ try { var result, lists, order_lists_bm, order_lists_records, parameter = $ctx.parameter; result = { head: { message: " ", code: $ctx.success ? 'success' : 'failure' }, body: { lists: [] } }; lists = result.body.lists; order_lists_bm = new ModelService('app.orderList'); //println(parameter.toXML()); param = { "record_num_from": (+parameter.page_num || 1) * 20, "record_num_to": +parameter.page_num ? (+parameter.page_num - 1) * 20 : 0, "filter_param": parameter.filter_param }; order_lists_records = order_lists_bm.queryAsMap(param).getChildren(); lists_len = order_lists_records.length; for (var i = 0;i < lists_len;i++) { lists.push({ "project_number":order_lists_records[i].project_number || " ", "project_id":order_lists_records[i].project_id || " ", "project_status_desc":order_lists_records[i].project_status_desc || " ", "bp_class":order_lists_records[i].bp_class || " ", "organization_code":order_lists_records[i].organization_code || " ", "bp_name":order_lists_records[i].bp_name || " ", "id_card_no":order_lists_records[i].id_card_no || " ", "project_source":order_lists_records[i].project_source || " " }) }; /*test*/ // result.head.message = model_len; } catch (e) { println(e); } finally { //执行finally代码,将result对象回写 // $ctx.parameter.json = JSON.stringify(result); $ctx.parameter.json = JSON.stringify(result); } ]]></s:server-script> </a:init-procedure> <a:service-output output="/parameter/@json"/> </a:service>