<?xml version="1.0" encoding="UTF-8"?> <!-- $Author: Calvin $Date: 2017年12月29日10:47:06 $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> <a:model-query fetchAll="true" model="hls.HLS530.get_batch_id" rootPath="batch_id_path"/> <p:echo/> <s:server-script><![CDATA[ var children = $ctx.parameter.getChildren(); var record_data = $ctx.get('/model/batch_id_path').getChildren(); var batch_id = record_data[0].batch_id; function lowerJSONKey(jsonObj) { for (var key in jsonObj) { jsonObj["\"" + key.toLowerCase() + "\""] = jsonObj[key]; delete(jsonObj[key]); } return jsonObj; } for (var i = 0;i < children.length;i++) { bp_id = children[i].bp_id; bp_class = children[i].bp_class; var bp_np_list_bm = $bm('interface.TONGDUN_INTERFACE.deron_tongdun_interface'); var bp_org_list_bm = $bm('interface.TONGDUN_INTERFACE.deron_tongdun_interface_org'); if (bp_class == 'NP') { var bp_list_result = bp_np_list_bm.queryAsMap({ "bp_id": bp_id }); var bp_list_records = bp_list_result.getChildren(); } else { var bp_list_result = bp_org_list_bm.queryAsMap({ "bp_id": bp_id }); var bp_list_records = bp_list_result.getChildren(); } var json_list = JSON.stringify(bp_list_records); json_list = json_list.replace(/\[|]/g, ''); // println(json_list); $bm('interface.TONGDUN_INTERFACE.deron_tongdun_interface').update({ batch_id: batch_id, bp_id: bp_id, json_list: json_list }); } ]]></s:server-script> <p:echo/> </a:init-procedure> <!-- <a:service-output output="/parameter"/> --> </a:service>